[Bug c++/36408] [4.3/4.4 regression] ICE with statement expression in template
--- Comment #13 from rguenth at gcc dot gnu dot org 2009-01-24 10:20 --- GCC 4.3.3 is being released, adjusting target milestone. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added Target Milestone|4.3.3 |4.3.4 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36408
[Bug c++/36408] [4.3/4.4 regression] ICE with statement expression in template
--- Comment #12 from jsm28 at gcc dot gnu dot org 2008-08-27 22:04 --- 4.3.2 is released, changing milestones to 4.3.3. -- jsm28 at gcc dot gnu dot org changed: What|Removed |Added Target Milestone|4.3.2 |4.3.3 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36408
[Bug c++/36408] [4.3/4.4 regression] ICE with statement expression in template
--- Comment #5 from dodji at gcc dot gnu dot org 2008-08-01 08:54 --- Created an attachment (id=15988) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15988action=view) first fix attempt. This patch fixes the problem for me on gcc-4_3-branch. Regtested for x86_64 on gcc-4_3-branch. I will recompile my trunk right away and test the patch there. If the patch looks okayish to you guys and works on trunk for me I can send it to gcc-patch for review. Comments welcome. Thanks. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36408
[Bug c++/36408] [4.3/4.4 regression] ICE with statement expression in template
-- dodji at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |dodji at gcc dot gnu dot org |dot org | Status|UNCONFIRMED |ASSIGNED Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2008-08-01 08:55:06 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36408
[Bug c++/36408] [4.3/4.4 regression] ICE with statement expression in template
--- Comment #6 from paolo dot carlini at oracle dot com 2008-08-01 09:07 --- Typo in dg-options: you mean c++0x -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36408
[Bug c++/36408] [4.3/4.4 regression] ICE with statement expression in template
--- Comment #7 from dodji at gcc dot gnu dot org 2008-08-01 09:33 --- Created an attachment (id=15989) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15989action=view) fixed a typo. Woops, thanks Paolo. I have Updated the patch. -- dodji at gcc dot gnu dot org changed: What|Removed |Added Attachment #15988|0 |1 is obsolete|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36408
[Bug c++/36408] [4.3/4.4 regression] ICE with statement expression in template
--- Comment #8 from dgregor at gcc dot gnu dot org 2008-08-01 11:55 --- Thanks Jakub, Dodji for working on this. Some comments: Some nits: - the error message we give in this case is pretty poor. Here we have an empty initializer, but the error message we get back is void value not ignored as it ought to be, which really doesn't tell us much of anything about the problem. The real issue here is that the statement expression has no return value, so we should say as such. This same problem can occur with non-empty statement expressions whose last statement does not produce a value, right? We should test this case, too. - since the statement-expression is obviously empty, can we produce this error message at template definition time, rather than waiting until instantiation time? (If the answer isn't a quick yes, don't worry about it; I'll eventually be going through the initialization bits to check more of them at template definition time anyway.) - is_pack_expansion_node_p is a pretty general name for a function that is specific to initializer lists (in general, a TREE_LIST with a pack expansion in its TREE_VALUE isn't necessarily an expansion node). I suggest calling this initializer_is_pack_expansion_p. - Please put some braces inside the if (init !t) block. Omitting the braces for then and else is okay for small one-liner bodies, but shouldn't be done when there are if-elses nested inside. - parse/empty-statement.C is a strange place to put this check, which deals with template instantiation. Perhaps call it template/empty-init-statement.C? - In the top of the testcase, PR c++/P36408 should be PR c++/36408 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36408
[Bug c++/36408] [4.3/4.4 regression] ICE with statement expression in template
--- Comment #9 from dodji at gcc dot gnu dot org 2008-08-01 13:32 --- Created an attachment (id=15991) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15991action=view) updated patch - the error message we give in this case is pretty poor. Here we have an empty initializer, but the error message we get back is void value not ignored as it ought to be, which really doesn't tell us much of anything about the problem. I agree. Though I think addressing that should be best done in another bug that we can open straight away when we close this one, if you agree. The real issue here is that the statement expression has no return value, so we should say as such. This same problem can occur with non-empty statement expressions whose last statement does not produce a value, right? We should test this case, too. I think the problem (g++ not issuing any warning) is due to the tsubsted initializer yielding NULL. An expression made of a statement list which last statement does not return any value whould be tsubsted to a statement list of type VOID_TYPE, I believe. For instance the current g++ 4.3.0 issues the warning for the following code snippet: void foo (); void bar (); void func () { int y = 0; int i = ({ foo (); if (y) bar (); }); } /home/dodji/devel/src/test.cc: In function 'void func()': /home/dodji/devel/src/test.cc:8: error: void value not ignored as it ought to be - since the statement-expression is obviously empty, can we produce this error message at template definition time, rather than waiting until instantiation time? (If the answer isn't a quick yes, don't worry about it; I'll eventually be going through the initialization bits to check more of them at template definition time anyway.) Yes, that would be handy. Though here again, I think we should be opening another bug to track that. - is_pack_expansion_node_p is a pretty general name for a function that is specific to initializer lists (in general, a TREE_LIST with a pack expansion in its TREE_VALUE isn't necessarily an expansion node). I suggest calling this initializer_is_pack_expansion_p. Right. This updated patch addresses that. - Please put some braces inside the if (init !t) block. Omitting the braces for then and else is okay for small one-liner bodies, but shouldn't be done when there are if-elses nested inside. Fixed in this udpated patch. - parse/empty-statement.C is a strange place to put this check, which deals with template instantiation. Perhaps call it template/empty-init-statement.C? Yup. Fixed. - In the top of the testcase, PR c++/P36408 should be PR c++/36408 Fixed as well. Thank you for your comments. -- dodji at gcc dot gnu dot org changed: What|Removed |Added Attachment #15989|0 |1 is obsolete|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36408
[Bug c++/36408] [4.3/4.4 regression] ICE with statement expression in template
--- Comment #10 from dgregor at gcc dot gnu dot org 2008-08-01 14:05 --- (In reply to comment #9) - the error message we give in this case is pretty poor. Here we have an empty initializer, but the error message we get back is void value not ignored as it ought to be, which really doesn't tell us much of anything about the problem. I agree. Though I think addressing that should be best done in another bug that we can open straight away when we close this one, if you agree. Agreed. - since the statement-expression is obviously empty, can we produce this error message at template definition time, rather than waiting until instantiation time? (If the answer isn't a quick yes, don't worry about it; I'll eventually be going through the initialization bits to check more of them at template definition time anyway.) Yes, that would be handy. Though here again, I think we should be opening another bug to track that. It's probably not worth opening a bug report for this, unless it's some placeholder bug that says, we should diagnose as many errors as template definition time as possible. Such a bug is almost impossible to close :) Your updated patch looks good, but I can't approve it. I suggesting pinging Jason to get approval. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36408
[Bug c++/36408] [4.3/4.4 regression] ICE with statement expression in template
--- Comment #11 from dodji at gcc dot gnu dot org 2008-08-01 17:54 --- Doug, thanks for your comments. I have submitted the patch to the list http://gcc.gnu.org/ml/gcc-patches/2008-08/msg00082.html. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36408
[Bug c++/36408] [4.3/4.4 regression] ICE with statement expression in template
--- Comment #4 from jakub at gcc dot gnu dot org 2008-06-12 10:13 --- Only partly fixed so far - we don't ICE anymore, but no warning is generated. See http://gcc.gnu.org/ml/gcc-patches/2008-06/msg00474.html Doug, any ideas how to differentiate between pack expansion resulting in no tsubsted code and statement expressions containing no statements (possibly nested)? -- jakub at gcc dot gnu dot org changed: What|Removed |Added CC||dgregor at gcc dot gnu dot ||org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36408
[Bug c++/36408] [4.3/4.4 regression] ICE with statement expression in template
--- Comment #2 from jakub at gcc dot gnu dot org 2008-06-11 06:31 --- Subject: Bug 36408 Author: jakub Date: Wed Jun 11 06:30:55 2008 New Revision: 136651 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=136651 Log: PR c++/36408 * semantics.c (stmt_expr_value_expr): Don't crash on empty STATEMENT_LIST. Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/semantics.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36408
[Bug c++/36408] [4.3/4.4 regression] ICE with statement expression in template
--- Comment #3 from jakub at gcc dot gnu dot org 2008-06-11 06:48 --- Subject: Bug 36408 Author: jakub Date: Wed Jun 11 06:47:36 2008 New Revision: 136652 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=136652 Log: PR c++/36408 * semantics.c (stmt_expr_value_expr): Don't crash on empty STATEMENT_LIST. Modified: branches/gcc-4_3-branch/gcc/cp/ChangeLog branches/gcc-4_3-branch/gcc/cp/semantics.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36408
[Bug c++/36408] [4.3/4.4 regression] ICE with statement expression in template
-- rguenth at gcc dot gnu dot org changed: What|Removed |Added Priority|P3 |P2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36408
[Bug c++/36408] [4.3/4.4 regression] ICE with statement expression in template
-- reichelt at gcc dot gnu dot org changed: What|Removed |Added Target Milestone|--- |4.3.1 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36408