Summary: | [4.3/4.4/4.5/4.6 Regression] internal compiler error: in gimplify_var_or_parm_decl, at gimplify.c:1946 | ||
---|---|---|---|
Product: | gcc | Reporter: | Christopher Head <headch> |
Component: | c++ | Assignee: | Jason Merrill <jason> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | jakub, jason, sezeroz |
Priority: | P2 | Keywords: | ice-on-valid-code |
Version: | 4.4.5 | ||
Target Milestone: | 4.6.1 | ||
Host: | Target: | ||
Build: | Known to work: | 3.4.3, 4.1.2, 4.7.0 | |
Known to fail: | 4.3.5, 4.5.2, 4.6.0 | Last reconfirmed: | 2011-04-05 11:13:04 |
Attachments: | The failing source file |
Description
Christopher Head
2011-04-05 03:54:20 UTC
Confirmed. Seems to have always crashed. ICC accepts it. Reduced testcase: namespace std { typedef long unsigned int size_t; } typedef unsigned char uint8_t; template<typename T> class RefPtr { public: ~RefPtr(); T *operator->() const; }; class Message { public: typedef RefPtr<Message> Ptr; static Ptr create(const void *data, std::size_t len); }; template<std::size_t N> class BitArray { public: static const std::size_t byte_count = (N + 7) / 8; }; class Recipient { public: typedef RefPtr<Recipient> Ptr; BitArray<80> data; }; class Sender { Recipient::Ptr recipient(unsigned int i); void flush(); }; void Sender::flush() { uint8_t buffer[64 / (recipient(0)->data.byte_count + 2)][recipient(0)->data.byte_count + 2]; std::size_t wptr = 0; if (wptr == sizeof(buffer) / sizeof(*buffer)) { Message::Ptr msg = Message::create(buffer, wptr * sizeof(buffer[0])); } } slightly further reduced: template<typename T> struct RefPtr { ~RefPtr(); T *operator->() const; }; struct Message { typedef RefPtr<Message> Ptr; static Ptr create(int); }; struct Recipient { typedef RefPtr<Recipient> Ptr; static const int byte_count = 80; }; Recipient::Ptr recipient(); void flush() { char buffer[(recipient()->byte_count)]; { Message::Ptr msg = Message::create(sizeof(buffer)); } } This is a regression as it compiles OK with GCC 4.1 (In reply to comment #2) > This is a regression as it compiles OK with GCC 4.1 ... and 3.4 template<typename T> struct A { ~A (); T *operator-> () const; }; struct B { typedef A <B> P; static P foo (int); }; struct C { typedef A<C> P; static const int c = 80; }; C::P bar (); void baz () { char z[bar ()->c]; { B::P m = B::foo (sizeof (z)); } } Yeah, apparently some problem on the FE side with cleanups, where CLEANUP_POINT_EXPR already for z is given the cleanups for m, which are in a nested bind though and thus m wasn't seen in bind expr yet. Most likely caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128979 (r128750 works, r129000 ICEs, am lazy to bisect it exactly). Author: jason Date: Thu Apr 14 14:59:58 2011 New Revision: 172432 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172432 Log: PR c++/48446 * decl.c (compute_array_index_type): Use get_temp_regvar instead of variable_size. * init.c (get_temp_regvar): No longer static. * cp-tree.h: Declare it. Added: trunk/gcc/testsuite/g++.dg/ext/vla10.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-tree.h trunk/gcc/cp/decl.c trunk/gcc/cp/init.c trunk/gcc/testsuite/ChangeLog This is now fixed for 4.7.0. The fix seems reasonably safe to backport since it only affects bounds expressions with side-effects, but it also seems easy to work around in user code: just factor out the bounds expression into a local variable. Author: jason Date: Mon May 2 18:38:44 2011 New Revision: 173264 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173264 Log: PR c++/48446 * decl.c (stabilize_save_expr_r, stabilize_vla_size): New. (compute_array_index_type): Revert earlier 48446 changes. (grokdeclarator): Use stabilize_vla_size. Added: trunk/gcc/testsuite/c-c++-common/vla-1.c Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/testsuite/ChangeLog Author: jason Date: Fri May 6 21:58:30 2011 New Revision: 173514 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173514 Log: PR c++/48446 * decl.c (stabilize_save_expr_r, stabilize_vla_size): New. (grokdeclarator): Use stabilize_vla_size. * init.c (get_temp_regvar): No longer static. * cp-tree.h: Declare it. Added: branches/gcc-4_6-branch/gcc/testsuite/c-c++-common/vla-1.c branches/gcc-4_6-branch/gcc/testsuite/g++.dg/ext/vla10.C Modified: branches/gcc-4_6-branch/gcc/cp/ChangeLog branches/gcc-4_6-branch/gcc/cp/cp-tree.h branches/gcc-4_6-branch/gcc/cp/decl.c branches/gcc-4_6-branch/gcc/cp/init.c branches/gcc-4_6-branch/gcc/testsuite/ChangeLog Fixed for 4.6.1. |