This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR17913:[4.0 Regression] ICE jumping into statement expression


Can we first determine if this code is valid at all?  Someone
optimistically added the ice-on-valid keyword, but I'm not so
sure if this test case you are fixing is valid code at all.
In fact, I'd argue that if we accepted it in the past, that
was an accepts-illegal bug.

The test case is the following:

void f(void) { 1 ? 1 : ({ a : 1; 1; }); goto a; }

So we are jumping into a statement expression. That looks wrong.

Ouch. Think about an extremely simplistic stack-based code generator, and feed it


  2 + ({ a: 3; });
  goto a;

This might be something like:

  push 2
a:
  push 3
  add
  goto a

That's a stack imbalance.

From some experiments, gcc manages to cope with this even with very complex nested expressions, but making labels local would make a lot of sense. I second your opinion and suggest marking as ice-on-invalid, closing as WONTFIX, and opening another accepts-invalid PR.

BTW, C++ accepts it for 3.3; I don't have 3.4 at hand.

Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]