Skip to content

Commit

Permalink
Merge pull request #128 from chaoticgd/builtinfixes
Browse files Browse the repository at this point in the history
Fix classification of builtins for some compiler versions
  • Loading branch information
chaoticgd authored Oct 22, 2023
2 parents fb67c72 + 87fab75 commit 628938f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## v1.2.1

- Fixed detection of bitfields where the underlying type is a typedef.
- Fixed a rare bug where unsigned 32-bit integer types were incorrectly classified as 64-bit types.
- Improved how floating point literals are printed for global data.

## v1.2
Expand Down
4 changes: 4 additions & 0 deletions ccc/ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ static bool detect_bitfield(const StabsField& field, const StabsToAstState& stat
}
}

if(underlying_type_size_bits == 0) {
return false;
}

return field.size_bits != underlying_type_size_bits;
}

Expand Down
2 changes: 1 addition & 1 deletion ccc/stabs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ static BuiltInClass classify_range(const std::string& low, const std::string& hi
{"000000000000000000000000", "001777777777777777777777", BuiltInClass::UNSIGNED_64},
{"00000000000000000000000000000000000000000000", "00000000000000000000001777777777777777777777", BuiltInClass::UNSIGNED_64},
{"0000000000000", "01777777777777777777777", BuiltInClass::UNSIGNED_64}, // iop
{"0", "4294967295", BuiltInClass::UNSIGNED_64},
{"0", "18446744073709551615", BuiltInClass::UNSIGNED_64},
{"001000000000000000000000", "000777777777777777777777", BuiltInClass::SIGNED_64},
{"00000000000000000000001000000000000000000000", "00000000000000000000000777777777777777777777", BuiltInClass::SIGNED_64},
{"01000000000000000000000", "0777777777777777777777", BuiltInClass::SIGNED_64}, // iop
Expand Down

0 comments on commit 628938f

Please sign in to comment.