Commit 754ccf7c by Jakub Jelinek Committed by Jakub Jelinek

re PR inline-asm/39059 (ICE with fixed-point type in inline-asm)

	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.

From-SVN: r143900
parent a36c33eb
2009-02-03 Jakub Jelinek <jakub@redhat.com>
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.
2009-02-02 Catherine Moore <clm@codesourcery.com>
* sde.h (SUBTARGET_ARM_SPEC): Don;t assemble -fpic code as
......
......@@ -7772,6 +7772,8 @@ finish_declspecs (struct c_declspecs *specs)
if (specs->saturating_p)
{
error ("%<_Sat%> is used without %<_Fract%> or %<_Accum%>");
if (!targetm.fixed_point_supported_p ())
error ("fixed-point types not supported for this target");
specs->typespec_word = cts_fract;
}
else if (specs->long_p || specs->short_p
......@@ -7894,8 +7896,10 @@ finish_declspecs (struct c_declspecs *specs)
specs->type = dfloat128_type_node;
break;
case cts_fract:
gcc_assert (!specs->complex_p);
if (specs->saturating_p)
gcc_assert (!specs->complex_p);
if (!targetm.fixed_point_supported_p ())
specs->type = integer_type_node;
else if (specs->saturating_p)
{
if (specs->long_long_p)
specs->type = specs->unsigned_p
......@@ -7913,7 +7917,7 @@ finish_declspecs (struct c_declspecs *specs)
specs->type = specs->unsigned_p
? sat_unsigned_fract_type_node
: sat_fract_type_node;
}
}
else
{
if (specs->long_long_p)
......@@ -7932,11 +7936,13 @@ finish_declspecs (struct c_declspecs *specs)
specs->type = specs->unsigned_p
? unsigned_fract_type_node
: fract_type_node;
}
}
break;
case cts_accum:
gcc_assert (!specs->complex_p);
if (specs->saturating_p)
gcc_assert (!specs->complex_p);
if (!targetm.fixed_point_supported_p ())
specs->type = integer_type_node;
else if (specs->saturating_p)
{
if (specs->long_long_p)
specs->type = specs->unsigned_p
......@@ -7954,7 +7960,7 @@ finish_declspecs (struct c_declspecs *specs)
specs->type = specs->unsigned_p
? sat_unsigned_accum_type_node
: sat_accum_type_node;
}
}
else
{
if (specs->long_long_p)
......@@ -7973,7 +7979,7 @@ finish_declspecs (struct c_declspecs *specs)
specs->type = specs->unsigned_p
? unsigned_accum_type_node
: accum_type_node;
}
}
break;
default:
gcc_unreachable ();
......
......@@ -5089,6 +5089,17 @@ c_parser_postfix_expression (c_parser *parser)
switch (c_parser_peek_token (parser)->type)
{
case CPP_NUMBER:
expr.value = c_parser_peek_token (parser)->value;
expr.original_code = ERROR_MARK;
loc = c_parser_peek_token (parser)->location;
c_parser_consume_token (parser);
if (TREE_CODE (expr.value) == FIXED_CST
&& !targetm.fixed_point_supported_p ())
{
error_at (loc, "fixed-point types not supported for this target");
expr.value = error_mark_node;
}
break;
case CPP_CHAR:
case CPP_CHAR16:
case CPP_CHAR32:
......
2009-02-03 Jakub Jelinek <jakub@redhat.com>
PR inline-asm/39059
* parser.c (cp_parser_primary_expression): Reject FIXED_CSTs.
PR c++/39056
* typeck2.c (digest_init_r): Don't call process_init_constructor
for COMPLEX_TYPE.
......
......@@ -3144,6 +3144,12 @@ cp_parser_primary_expression (cp_parser *parser,
case CPP_WCHAR:
case CPP_NUMBER:
token = cp_lexer_consume_token (parser->lexer);
if (TREE_CODE (token->u.value) == FIXED_CST)
{
error ("%Hfixed-point types not supported in C++",
&token->location);
return error_mark_node;
}
/* Floating-point literals are only allowed in an integral
constant expression if they are cast to an integral or
enumeration type. */
......
2009-02-03 Jakub Jelinek <jakub@redhat.com>
PR inline-asm/39059
* 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.
PR c++/39056
* g++.dg/cpp0x/initlist13.C: New test.
......
// PR c++/38655
// { dg-options "" }
__decltype(0r)* p = 1; // { dg-error "unnamed-fixed" }
__decltype(0r)* p = 1; // { dg-error "not supported|invalid" }
......@@ -3,6 +3,6 @@
template<int> struct A {};
template<typename> struct B : A<sizeof(0=0r)> {};
template<typename> struct B : A<sizeof(0=0r)> {}; // { dg-error "not supported" }
template<typename> struct C : A<sizeof(0=0r)> {};
template<typename> struct C : A<sizeof(0=0r)> {}; // { dg-error "not supported" }
......@@ -3,5 +3,5 @@
void foo()
{
throw 0r;
throw 0r; // { dg-error "not supported" }
}
......@@ -5,5 +5,5 @@ void foo(int);
void bar()
{
foo(1r); // { dg-error "unnamed-fixed" }
foo(1r); // { dg-error "not supported" }
}
// PR c++/35338
// { dg-options "" }
int i = 0r; // { dg-error "unnamed-fixed" }
bool b = !0r; // { dg-error "0.0|argument" }
int i = 0r; // { dg-error "not supported" }
bool b = !0r; // { dg-error "not supported" }
/* PR inline-asm/39059 */
/* { dg-do compile { target {! fixed_point} } } */
/* { dg-options "-std=gnu99" } */
void
f1 (void)
{
asm ("" : : "r" (0r)); /* { dg-error "not supported" "reject fixed-point" } */
}
__typeof (0r) /* { dg-error "not supported" "reject fixed-point" } */
b2 (void)
{
return 0r; /* { dg-error "not supported" "reject fixed-point" } */
}
_Accum /* { dg-error "not supported" "reject fixed-point" } */
f3 (void)
{
return 0k; /* { dg-error "not supported" "reject fixed-point" } */
}
_Sat
f4 (void) /* { dg-error "not supported" "reject fixed-point" } */
{
return 0k; /* { dg-error "not supported" "reject fixed-point" } */
}
/* { dg-warning "defaults to" "" { target *-*-* } 13 } */
/* { dg-error "is used without" "" { target *-*-* } 24 } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment