Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash: record with oversize array #678

Closed
ehaas opened this issue Apr 9, 2024 · 1 comment · Fixed by #680
Closed

Crash: record with oversize array #678

ehaas opened this issue Apr 9, 2024 · 1 comment · Fixed by #680
Labels
bug Something isn't working crash A bug that causes the compiler to crash

Comments

@ehaas
Copy link
Collaborator

ehaas commented Apr 9, 2024

union U {
    int a;
    char bytes[3333333333333333333];
};
panic: integer overflow
/Users/ehaas/source/arocc/src/aro/record_layout.zig:259:59: 0x105d1999e in layoutRegularField (arocc)
        self.size_bits = @max(self.size_bits, offset_bits + size_bits);
                                                          ^
/Users/ehaas/source/arocc/src/aro/record_layout.zig:71:57: 0x105ca00aa in layoutFields (arocc)
                    fld.layout = self.layoutRegularField(field_attrs, type_layout);
                                                        ^
/Users/ehaas/source/arocc/src/aro/record_layout.zig:577:33: 0x105beb0e1 in compute (arocc)
            context.layoutFields(rec);
                                ^
@ehaas ehaas added bug Something isn't working crash A bug that causes the compiler to crash labels Apr 9, 2024
@ehaas
Copy link
Collaborator Author

ehaas commented Apr 9, 2024

All additions/multiplications in the record layout code should be audited for overflows; this will trigger a different one:

struct S {
    __attribute__((aligned(268435456))) int x;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crash A bug that causes the compiler to crash
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant