Skip to content

Ignore top level qualifiers in __builtin_types_compatible_p#157

Merged
karoliineh merged 2 commits intodevelopfrom
builtin_types_compatible
Oct 3, 2023
Merged

Ignore top level qualifiers in __builtin_types_compatible_p#157
karoliineh merged 2 commits intodevelopfrom
builtin_types_compatible

Conversation

@karoliineh
Copy link
Copy Markdown
Member

When trying to analyze the https://github.com/git/git repository, we encountered the following error:

parse-options.c:710: Error: Length of array is negative
Error: There were parsing errors in /home/ubuntu/goblint/new-benchmarks/git/.goblint/preprocessed/parse-options.i

This was due to CIL not understanding that in a construct like

const int *a;
int *ret;
sizeof(*(ret)) + (sizeof(char [1 - 2*!(__builtin_types_compatible_p(__typeof__(*((ret))), __typeof__(*((a)))))]) - 1);

the types are the same.

The built-in function: int __builtin_types_compatible_p (type1, type2) actually ignores the top level qualifiers (e.g., const, volatile), which was not the case in CIL.

This PR adds a test case and fixes the aforementioned issue.

@karoliineh karoliineh added the bug label Oct 2, 2023
@karoliineh karoliineh self-assigned this Oct 2, 2023
@michael-schwarz michael-schwarz added this to the 2.0.3 milestone Oct 3, 2023
@karoliineh karoliineh merged commit 13efd21 into develop Oct 3, 2023
@karoliineh karoliineh deleted the builtin_types_compatible branch October 3, 2023 10:41
sim642 added a commit to sim642/opam-repository that referenced this pull request Nov 20, 2023
CHANGES:

* Add `asm inline` parsing (goblint/cil#151).
* Ignore top level qualifiers in `__builtin_types_compatible_p` (goblint/cil#157).
* Add attribute `goblint_cil_nested` to local variables in inner scopes (goblint/cil#155).
* Expose `Cil.typeSigAddAttrs`.
* Add option to suppress `long double` warnings (goblint/cil#136, goblint/cil#156).
* Fix syntactic search (goblint/cil#147).
nberth pushed a commit to nberth/opam-repository that referenced this pull request Jun 18, 2024
CHANGES:

* Add `asm inline` parsing (goblint/cil#151).
* Ignore top level qualifiers in `__builtin_types_compatible_p` (goblint/cil#157).
* Add attribute `goblint_cil_nested` to local variables in inner scopes (goblint/cil#155).
* Expose `Cil.typeSigAddAttrs`.
* Add option to suppress `long double` warnings (goblint/cil#136, goblint/cil#156).
* Fix syntactic search (goblint/cil#147).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants