aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2016-08-25 08:22:56 +0000
committerMarek Polacek <polacek@redhat.com>2016-08-25 08:22:56 +0000
commit78187df73241faad55a601d88e61bc56f3e58e3d (patch)
tree486a8bdcc3246d93af945a8d4d31cfe1000b0fc9
parent86161df4b06966a87523c97d6853d1a4e728579e (diff)
PR c/77323
* c-decl.c (declspecs_add_type): Set typespec_word even when __intN or _FloatN or _FloatNx is not supported. (finish_declspecs): Set type to integer_type_node when _FloatN or _FloatNx is not supported. * gcc.dg/pr77323.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@239752 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/c/ChangeLog8
-rw-r--r--gcc/c/c-decl.c35
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr77323.c6
4 files changed, 41 insertions, 13 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 8d9d4aabb0a..dc863bb4a1b 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,11 @@
+2016-08-25 Marek Polacek <polacek@redhat.com>
+
+ PR c/77323
+ * c-decl.c (declspecs_add_type): Set typespec_word even when __intN
+ or _FloatN or _FloatNx is not supported.
+ (finish_declspecs): Set type to integer_type_node when _FloatN or
+ _FloatNx is not supported.
+
2016-08-19 Joseph Myers <joseph@codesourcery.com>
PR c/32187
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 0fb2d206458..0c52a64a77e 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -10190,10 +10190,13 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
("both %<__int%d%> and %<short%> in "
"declaration specifiers"),
int_n_data[specs->int_n_idx].bitsize);
- else if (! int_n_enabled_p [specs->int_n_idx])
- error_at (loc,
- "%<__int%d%> is not supported on this target",
- int_n_data[specs->int_n_idx].bitsize);
+ else if (! int_n_enabled_p[specs->int_n_idx])
+ {
+ specs->typespec_word = cts_int_n;
+ error_at (loc,
+ "%<__int%d%> is not supported on this target",
+ int_n_data[specs->int_n_idx].bitsize);
+ }
else
{
specs->typespec_word = cts_int_n;
@@ -10400,12 +10403,15 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
? "x"
: ""));
else if (FLOATN_NX_TYPE_NODE (specs->floatn_nx_idx) == NULL_TREE)
- error_at (loc,
- "%<_Float%d%s%> is not supported on this target",
- floatn_nx_types[specs->floatn_nx_idx].n,
- (floatn_nx_types[specs->floatn_nx_idx].extended
- ? "x"
- : ""));
+ {
+ specs->typespec_word = cts_floatn_nx;
+ error_at (loc,
+ "%<_Float%d%s%> is not supported on this target",
+ floatn_nx_types[specs->floatn_nx_idx].n,
+ (floatn_nx_types[specs->floatn_nx_idx].extended
+ ? "x"
+ : ""));
+ }
else
{
specs->typespec_word = cts_floatn_nx;
@@ -10892,9 +10898,12 @@ finish_declspecs (struct c_declspecs *specs)
case cts_floatn_nx:
gcc_assert (!specs->long_p && !specs->short_p
&& !specs->signed_p && !specs->unsigned_p);
- specs->type = (specs->complex_p
- ? COMPLEX_FLOATN_NX_TYPE_NODE (specs->floatn_nx_idx)
- : FLOATN_NX_TYPE_NODE (specs->floatn_nx_idx));
+ if (FLOATN_NX_TYPE_NODE (specs->floatn_nx_idx) == NULL_TREE)
+ specs->type = integer_type_node;
+ else if (specs->complex_p)
+ specs->type = COMPLEX_FLOATN_NX_TYPE_NODE (specs->floatn_nx_idx);
+ else
+ specs->type = FLOATN_NX_TYPE_NODE (specs->floatn_nx_idx);
break;
case cts_dfloat32:
case cts_dfloat64:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 527f2011ac7..f4dddd8bea3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-08-25 Marek Polacek <polacek@redhat.com>
+
+ PR c/77323
+ * gcc.dg/pr77323.c: New test.
+
2016-08-24 Paul Thomas <pault@gcc.gnu.org>
PR fortran/77358
diff --git a/gcc/testsuite/gcc.dg/pr77323.c b/gcc/testsuite/gcc.dg/pr77323.c
new file mode 100644
index 00000000000..281c334749a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr77323.c
@@ -0,0 +1,6 @@
+/* PR c/77323 */
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "" } */
+
+__int128 a; /* { dg-error "not supported" } */
+_Float128x b; /* { dg-error "not supported" } */