-
Notifications
You must be signed in to change notification settings - Fork 55
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
More fuzzer-discovered crash fixes #707
Conversation
Can you give an example of the crash this prevents? |
Prevents a crash when trying to do arithmetic with values of that type
The field access validation code previously assumed that nested record fields were not attributed
_Complex float x = 1.0f16 + 2i; |
Should I add this as a test with a |
The TODO could be avoided by reversing #454 for diff --git a/src/aro/Parser.zig b/src/aro/Parser.zig
index 5bb1784..77eea6c 100644
--- a/src/aro/Parser.zig
+++ b/src/aro/Parser.zig
@@ -5758,8 +5758,8 @@ pub const Result = struct {
// No `_Complex _Float16`
.{ .invalid, .float16 },
};
- const a_spec = a.ty.canonicalize(.standard).specifier;
- const b_spec = b.ty.canonicalize(.standard).specifier;
+ var a_spec = a.ty.canonicalize(.standard).specifier;
+ var b_spec = b.ty.canonicalize(.standard).specifier;
if (p.comp.target.c_type_bit_size(.longdouble) == 128) {
if (try a.floatConversion(b, a_spec, b_spec, p, float_types[0])) return;
}
@@ -5771,9 +5771,18 @@ pub const Result = struct {
if (p.comp.target.c_type_bit_size(.longdouble) == 64) {
if (try a.floatConversion(b, a_spec, b_spec, p, float_types[0])) return;
}
+ if (a_spec == .fp16 and b.ty.isComplex()) {
+ try a.floatCast(p, .{ .specifier = .float });
+ a_spec = .float;
+ }
+ if (b_spec == .fp16 and a.ty.isComplex()) {
+ try b.floatCast(p, .{ .specifier = .float });
+ b_spec = .float;
+ }
if (try a.floatConversion(b, a_spec, b_spec, p, float_types[3])) return;
if (try a.floatConversion(b, a_spec, b_spec, p, float_types[4])) return;
if (try a.floatConversion(b, a_spec, b_spec, p, float_types[5])) return;
+ unreachable;
}
if (a.ty.eql(b.ty, p.comp, true)) { |
I must have tested on an ancient version of clang - looks like |
No description provided.