Bug 39059 - [4.3 regression] ICE with fixed-point type in inline-asm
Summary: [4.3 regression] ICE with fixed-point type in inline-asm
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: inline-asm (show other bugs)
Version: 4.4.0
: P2 normal
Target Milestone: 4.4.0
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code, monitored
Depends on:
Blocks:
 
Reported: 2009-02-01 11:14 UTC by Volker Reichelt
Modified: 2011-06-27 11:46 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-02-03 10:06:51


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2009-02-01 11:14:03 UTC
The following (IMHO valid) testcase triggers an ICE since GCC 4.3.0
(when fixed-point types were introduced):

============================================================
void foo()
{
  asm("" : : "r"(0r));
}
============================================================

bug.c: In function 'foo':
bug.c:4: internal compiler error: in init_move_cost, at reginfo.c:270
Please submit a full bug report, [etc.]

Technically, this is a regression since the code did not crash the
compiler before (because it was rejected earlier).
Comment 1 Jakub Jelinek 2009-02-03 10:06:50 UTC
Similarly
__typeof (0r)
foo (void)
{
  return 0r;
}
ICEs on x86-64 and so does
_Fract foo (void)
{
  return 0r;
}
(the last one just as error-recovery ICE).  I'd say for
!targetm.fixed_point_supported_p () we should remove the loop hole that fixed-point constants introduce fixed point types without any error, similarly for C++ we should reject FIXED_CSTs, and to improve error-recovery, we shouldn't used fixed point types after we've diagnosed we don't support them.
Comment 2 Jakub Jelinek 2009-02-03 17:26:55 UTC
Subject: Bug 39059

Author: jakub
Date: Tue Feb  3 17:26:28 2009
New Revision: 143900

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143900
Log:
	PR inline-asm/39059
	* c-parser.c (c_parser_postfix_expression): If fixed point is not
	supported, don't accept FIXED_CSTs.
	* c-decl.c (finish_declspecs): Error if fixed point is not supported
	and _Sat is used without _Fract/_Accum.  Set specs->type to
	integer_type_node for cts_fract/cts_accum if fixed point is not
	supported.

	* parser.c (cp_parser_primary_expression): Reject FIXED_CSTs.

	* gcc.dg/nofixed-point-2.c: New test.
	* g++.dg/ext/fixed1.C: Adjust expected diagnostics.
	* g++.dg/ext/fixed2.C: Likewise.
	* g++.dg/other/error25.C: Likewise.
	* g++.dg/lookup/crash7.C: Likewise.
	* g++.dg/cpp0x/decltype-38655.C: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/nofixed-point-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-decl.c
    trunk/gcc/c-parser.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/cpp0x/decltype-38655.C
    trunk/gcc/testsuite/g++.dg/ext/fixed1.C
    trunk/gcc/testsuite/g++.dg/ext/fixed2.C
    trunk/gcc/testsuite/g++.dg/lookup/crash7.C
    trunk/gcc/testsuite/g++.dg/other/error25.C

Comment 3 Jakub Jelinek 2009-02-03 19:30:45 UTC
Fixed on the trunk.
Comment 4 Richard Biener 2009-08-04 12:29:53 UTC
GCC 4.3.4 is being released, adjusting target milestone.
Comment 5 Richard Biener 2010-05-22 18:13:22 UTC
GCC 4.3.5 is being released, adjusting target milestone.
Comment 6 Richard Biener 2011-06-27 11:46:20 UTC
Fixed for 4.4.0