[cfe-dev] Fwd: external function codegen bug
Chris Lattner
clattner at apple.com
Fri May 23 09:12:45 PDT 2008
On May 23, 2008, at 4:15 AM, Eli Friedman wrote:
> On Fri, May 23, 2008 at 2:37 AM, Csaba Hruska
> <csaba.hruska at gmail.com> wrote:
>> buggy code:
>>
>> extern double g ();
>> void f()
>> {
>> double t, g();
>> t = g();
>> }
>
> I'm pretty sure it's an issue with merging function decls. The issue
> is that t essentially disappears from the AST (try running this code
> through -ast-dump to see what I mean), so CodeGen ends up seeing a
> reference to an undeclared variable. Declaration merging and whatnot
> is tricky code that I never really studied closely, though, so it's
> not obvious why this is happening.
One approach would be to have two predicates: one for "real i-c-e" and
one for "gcc i-c-e". If it is a GCC ICE but not a standards one,
accept but emit a diagnostic? In this case, it is pretty easy, in
other cases (such as when dealing with ?: promotion rules) it is much
harder.
I don't know if it is worth it though. The set of stuff accepted by
GCC is, uh, "poorly defined".
-Chris
More information about the cfe-dev
mailing list