-
Notifications
You must be signed in to change notification settings - Fork 124
infer: three fuzzer crashes from #4044 #4049
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2716,6 +2716,7 @@ namespace das { | |
| return new ExprConstBool(expr->at, ft != nullptr); | ||
| } else { | ||
| if (expr->trait == "safe_has_field") { | ||
| reportAstChanged(); | ||
| return new ExprConstBool(expr->at, false); | ||
| } else { | ||
| error("typeinfo(has_field<" + expr->subtrait + "> ...) is only defined for structures and handled types, " + describeType(expr->typeexpr), "", "", | ||
|
|
@@ -2730,6 +2731,7 @@ namespace das { | |
| return new ExprConstBool(expr->at, it != ann.end()); | ||
| } else { | ||
| if (expr->trait == "struct_safe_has_annotation") { | ||
| reportAstChanged(); | ||
| return new ExprConstBool(expr->at, false); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
| } else { | ||
| error("typeinfo(struct_has_annotation<" + expr->subtrait + "> ...) is only defined for structures, " + describeType(expr->typeexpr), "", "", | ||
|
|
@@ -2742,6 +2744,7 @@ namespace das { | |
| auto it = find_if(ann.begin(), ann.end(), [&](const AnnotationDeclarationPtr &pa) { return pa->annotation->name == expr->subtrait; }); | ||
| if (it == ann.end()) { | ||
| if (expr->trait == "struct_safe_has_annotation_argument") { | ||
| reportAstChanged(); | ||
| return new ExprConstBool(expr->at, false); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same again. why is this an ast change? |
||
| } else { | ||
| error("typeinfo(struct_has_annotation_argument<" + expr->subtrait + ";" + expr->extratrait + "> ...) annotation not found ", "", "", | ||
|
|
@@ -2755,6 +2758,7 @@ namespace das { | |
| } | ||
| } else { | ||
| if (expr->trait == "struct_safe_has_annotation_argument") { | ||
| reportAstChanged(); | ||
| return new ExprConstBool(expr->at, false); | ||
| } else { | ||
| error("typeinfo(struct_has_annotation_argument<" + expr->subtrait + "> ...) is only defined for structures, " + describeType(expr->typeexpr), "", "", | ||
|
|
@@ -4600,6 +4604,9 @@ namespace das { | |
| return Visitor::visit(expr); | ||
| } | ||
| expr->variable = var; | ||
| if (var->type->isExprType()) { | ||
| return Visitor::visit(expr); | ||
| } | ||
| TypeDecl::clone(expr->type, var->type); | ||
| expr->type->ref = true; | ||
| return Visitor::visit(expr); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // A class deriving from a class whose own declaration is rejected. The `class B : A` error | ||
| // returns before B gets its generated __rtti and __finalize fields, so `class C : B` - which is | ||
| // accepted - reaches field generation with a parent that carries neither. | ||
| options gen2 | ||
| expect 30134 | ||
|
|
||
| struct A; | ||
| class B : A; | ||
| class C : B; | ||
|
|
||
| [export] | ||
| def main { | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // A global whose fixed-array dimension names the variable it declares. The dimension expression | ||
| // sits inside the type it dimensions, so a reference that takes the variable's own type takes a | ||
| // type holding that reference; with two dimensions each infer pass squares the last one's copy. | ||
| // The array clone in main is what keeps the passes coming. | ||
| options gen2 | ||
| expect 30109:2 | ||
|
|
||
| let zz : int[zz][zz] | ||
|
|
||
| [export] | ||
| def main { | ||
| var cb : array<int> | ||
| cb := cb | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // A safe_* typeinfo trait that answers false replaces its node, so it tells infer to run again. | ||
| // Each arm takes its value from a nested typeinfo, or from an index that folds, so the trait | ||
| // resolves one pass late - in a pass where nothing else changes, which is the pass that catches a | ||
| // missing signal. Keep this file free of anything that keeps signalling (a print's string builder | ||
| // will do it): that grants the enclosing operator a repair pass and the arms stop proving anything. | ||
| // Without the signal every arm reports 50613 instead, the reported input included. | ||
| options gen2 | ||
| expect 30341 | ||
|
|
||
| [comment(i = 1)] | ||
| struct TsrAnnotated { | ||
| x : int | ||
| } | ||
|
|
||
| var g_tsr_annotated : TsrAnnotated[8] | ||
|
|
||
| [export] | ||
| def main { | ||
| var a = true | ||
| a &&= typeinfo safe_has_field < no_such_field > (typeinfo is_ref(1)) | ||
| var b = true | ||
| b &&= typeinfo struct_safe_has_annotation < no_such_annotation > (typeinfo is_ref(1)) | ||
| var c = true | ||
| c &&= typeinfo struct_safe_has_annotation_argument < no_such_annotation; no_such_argument > (typeinfo is_ref(1)) | ||
| var d = true | ||
| d &&= typeinfo struct_safe_has_annotation_argument < no_such_annotation; no_such_argument > (g_tsr_annotated[typeinfo sizeof(type<int>)]) | ||
| 1 &&= typeinfo safe_has_field < no_such_type > (typeinfo is_ref(1)) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how so? why is this an AST change??