Bug 27451 - [4.0/4.1/4.2 regression] ICE with invalid asm statement
Summary: [4.0/4.1/4.2 regression] ICE with invalid asm statement
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.0.4
Assignee: Volker Reichelt
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: error-recovery, ice-on-invalid-code, monitored, patch
Depends on:
Blocks:
 
Reported: 2006-05-06 01:13 UTC by Volker Reichelt
Modified: 2006-05-29 07:08 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-05-07 08:16:10


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-05-06 01:13:56 UTC
The following invalid testcase crashes the C++ frontend since GCC 3.4.0:

=====================
void foo()
{
  asm("" ::: X);
}
=====================

bug.cc: In function 'void foo()':
bug.cc:3: error: expected string-literal before 'X'
bug.cc:3: error: expected `)' before 'X'
bug.cc:3: internal compiler error: tree check: expected string_cst, have error_mark in expand_asm_operands, at stmt.c:696
Please submit a full bug report, [etc.]

The C frontend is not affected.
Comment 1 Andrew Pinski 2006-05-07 08:16:10 UTC
Confirmed, the C front-end does not even include the asm in the IR while the C++ Front-end does.
Comment 2 patchapp@dberlin.org 2006-05-22 09:20:41 UTC
Subject: Bug number PR c++/27451

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-05/msg01090.html
Comment 3 Volker Reichelt 2006-05-22 09:21:54 UTC
Posted a patch.
Comment 4 Volker Reichelt 2006-05-22 16:49:41 UTC
Subject: Bug 27451

Author: reichelt
Date: Mon May 22 16:49:33 2006
New Revision: 113985

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113985
Log:
	PR c++/27451
	* stmt.c (expand_asm_operands): Skip asm statement with erroneous
	clobbers.

	* g++.dg/ext/asm9.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/ext/asm9.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/stmt.c
    trunk/gcc/testsuite/ChangeLog

Comment 5 Volker Reichelt 2006-05-22 16:53:50 UTC
Subject: Bug 27451

Author: reichelt
Date: Mon May 22 16:53:38 2006
New Revision: 113986

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113986
Log:
	PR c++/27451
	* stmt.c (expand_asm_operands): Skip asm statement with erroneous
	clobbers.

	* g++.dg/ext/asm9.C: New test.

Added:
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/ext/asm9.C
Modified:
    branches/gcc-4_0-branch/gcc/ChangeLog
    branches/gcc-4_0-branch/gcc/stmt.c
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog

Comment 6 Volker Reichelt 2006-05-22 16:55:39 UTC
Fixed on mainline and 4.0 branch.
Waiting for the 4.1 branch to thaw.
Comment 7 Volker Reichelt 2006-05-29 06:50:21 UTC
Subject: Bug 27451

Author: reichelt
Date: Mon May 29 06:50:07 2006
New Revision: 114189

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114189
Log:
	PR c++/27451
	* stmt.c (expand_asm_operands): Skip asm statement with erroneous
	clobbers.

	* g++.dg/ext/asm9.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/ext/asm9.C
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/stmt.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 8 Volker Reichelt 2006-05-29 07:08:03 UTC
Now also fixed on the 4.1 branch.