This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/84961] [7/8 Regression] ICE error: SSA_NAME_DEF_STMT is wrong
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 20 Mar 2018 08:57:45 +0000
- Subject: [Bug c++/84961] [7/8 Regression] ICE error: SSA_NAME_DEF_STMT is wrong
- Auto-submitted: auto-generated
- References: <bug-84961-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84961
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|ice-on-invalid-code |ice-on-valid-code
Priority|P3 |P2
Status|NEW |ASSIGNED
CC| |jason at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we do
tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p,
is_inout ? is_gimple_min_lval : is_gimple_lvalue,
fb_lvalue | fb_mayfail);
and gimplify b = (double) a to _3 with is_gimple_lvalue. Which it isn't
here (the predicate returns true though).
With a similar
int main()
{
int a,b,c;
(b = c) = a;
}
the FE already replaces this with <<error_mark_node>> so it doesn't reach
gimplification. It seems it expects the gimplifier to do this here.
Note the C FE complains:
t.c: In function ‘c’:
t.c:3:12: error: lvalue required in asm statement
void c() { asm("" : "=a"(b = a)); }
^~~
but still throws the invalid asm at the gimplifier. The C++ FE fails to
complain, but I guess (b = a) is an lvalue for C++? In which case the
testcase would be valid C++ but invalid C? G++ 6 accepts it.
The above testcase is genericized to
<<cleanup_point <<< Unknown tree: expr_stmt
(void) (b = c;, b = a) >>>>>;
but the asm stays
<<cleanup_point __asm__("":"=a" b = (double) a:)>>;
I think the C++ FE should help us here by genericizing to b = (double) a; b?