Skip to content

Conversation

jserv
Copy link
Collaborator

@jserv jserv commented Aug 26, 2025

This commit fixes multiple issues with typedef pointer handling:

  1. Remove incorrect pointer level inheritance in read_full_var_decl()
    • Previously caused double indirection bugs with typedef pointers
    • Variables now maintain separate pointer levels from their types
  2. Implement proper pointer arithmetic for typedef pointers
    • Add scaling for binary addition/subtraction (p+n, p-n, n+p)
    • Fix increment/decrement operators (++p, p++, --p, p--)
    • Calculate element size based on base type (int=4, char=1, etc.)
  3. Enable array indexing for typedef pointers
    • Recognize typedef pointers in square bracket operations
    • Properly calculate element sizes for array access

@jserv jserv force-pushed the typedef-pointer branch 2 times, most recently from b3e4cd2 to 378c691 Compare August 26, 2025 06:53
jserv added 2 commits August 28, 2025 18:49
This commit fixes multiple issues with typedef pointer handling:
1. Remove incorrect pointer level inheritance in read_full_var_decl()
   - Previously caused double indirection bugs with typedef pointers
   - Variables now maintain separate pointer levels from their types
2. Implement proper pointer arithmetic for typedef pointers
   - Add scaling for binary addition/subtraction (p+n, p-n, n+p)
   - Fix increment/decrement operators (++p, p++, --p, p--)
   - Calculate element size based on base type (int=4, char=1, etc.)
3. Enable array indexing for typedef pointers
   - Recognize typedef pointers in square bracket operations
   - Properly calculate element sizes for array access
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant