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 3 times, most recently from 378c691 to bb34a74 Compare August 28, 2025 11:03
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 merged commit 3746f8d into master Sep 2, 2025
12 checks passed
@jserv jserv deleted the typedef-pointer branch September 2, 2025 23:29
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.

2 participants