aaron.ballman added reviewers: rjmccall, efriedma.
aaron.ballman added a comment.

In D152818#4417704 <https://reviews.llvm.org/D152818#4417704>, @zahiraam wrote:

> In D152818#4417683 <https://reviews.llvm.org/D152818#4417683>, @tbaeder wrote:
>
>> In D152818#4417649 <https://reviews.llvm.org/D152818#4417649>, @zahiraam 
>> wrote:
>>
>>> In D152818#4417644 <https://reviews.llvm.org/D152818#4417644>, @tbaeder 
>>> wrote:
>>>
>>>> Has the test case been obfuscated on purpose?
>>>
>>> This is a smaller reproducible from creduce. Didn't know if it would be OK 
>>> to have an include in a LIT test?
>>
>> Okay, not sure if we have a policy regarding that. Just looking at it, I 
>> don't think anyone understands what it's doing.
>
> It's definitely related to the use of the pragma and the throw function. I 
> could put the "fstream" header in an Inputs folder? I see an #include 
> <stdio.h> in Analysis/z3/Inputs/MockZ3_solver_check.c.

No, we don't want to include actual STL header content in the lit tests (we 
will mock up interfaces as needed, but they're usually uninteresting). It's 
worth noting that the original test case in your godbolt link has a quite 
different stack trace than your reduced example (they still end up in the same 
function though), so are there two different bugs? 
https://godbolt.org/z/Yaf5185cE

I spent some time reducing the test case down to:

  void g(const char *);
  
  template <class>
  struct q {
    static void r() { g(""); }
  };
  
  #pragma STDC FENV_ACCESS ON
  void a() { q<int>::r(); }

so there's nothing to do with `throw` expressions as the summary says. As best 
I can tell, this has something to do with template instantiation (making `q` no 
longer a template or calling `g()` directly both cause the issue to go away). 
I'd like to know a bit more about why the changes to the assertion are correct.



================
Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:161-164
   assert((CGF.CurFuncDecl == nullptr || CGF.Builder.getIsFPConstrained() ||
           isa<CXXConstructorDecl>(CGF.CurFuncDecl) ||
           isa<CXXDestructorDecl>(CGF.CurFuncDecl) ||
+          isa<FunctionDecl>(CGF.CurFuncDecl) ||
----------------
Constructors and destructors are function declarations, so those no longer need 
an explicit check.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152818/new/

https://reviews.llvm.org/D152818

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to