This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

3.4 backport patches


Here are backports of three C regression fixes to 3.4 branch.
Bootstrapped (together) with no regressions on
x86_64-unknown-linux-gnu.  Applied to 3.4 branch.

Note that bugs 20740 and 21213 had already been closed on the basis of
being fixed in 4.0.1 and mainline, although not previously fixed in
3.4 branch.  Note also that the backported fix for bug 18502 includes
a fix for bug 11459 on which the first fix depends; bug 11459 was
fixed in 4.0 and not itself a regression.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)

2005-05-01  Joseph S. Myers  <joseph@codesourcery.com>

	PR c/11459
	PR c/18502
	* gcc.c (cpp_unique_options): Remove %{trigraphs}.
	(cpp_options, cc1_options): Change %{std*} %{ansi} to
	%{std*&ansi&trigraphs}.

testsuite:
2005-05-01  Joseph S. Myers  <joseph@codesourcery.com>

	PR c/11459
	PR c/18502
	* gcc.dg/pr11459-1.c, gcc.dg/pr18502-1.c: New tests.

diff -rupN GCC.orig/gcc/gcc.c GCC/gcc/gcc.c
--- GCC.orig/gcc/gcc.c	2004-09-08 15:16:11.000000000 +0000
+++ GCC/gcc/gcc.c	2005-04-29 21:02:41.000000000 +0000
@@ -746,7 +746,7 @@ static const char *cpp_unique_options =
  %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}}\
  %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*}\
  %{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ %*}}}}}\
- %{trigraphs} %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i\
+ %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i\
  %{E|M|MM:%W{o*}}";
 
 /* This contains cpp options which are common with cc1_options and are passed
@@ -755,8 +755,9 @@ static const char *cpp_unique_options =
    options used to set target flags.  Those special target flags settings may
    in turn cause preprocessor symbols to be defined specially.  */
 static const char *cpp_options =
-"%(cpp_unique_options) %1 %{m*} %{std*} %{ansi} %{W*&pedantic*} %{w} %{f*}\
- %{g*:%{!g0:%{!fno-working-directory:-fworking-directory}}} %{O*} %{undef}";
+"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
+ %{f*} %{g*:%{!g0:%{!fno-working-directory:-fworking-directory}}} %{O*}\
+ %{undef}";
 
 /* This contains cpp options which are not passed when the preprocessor
    output will be used by another program.  */
@@ -767,7 +768,7 @@ static const char *cc1_options =
 "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\
  %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}}\
- %{g*} %{O*} %{W*&pedantic*} %{w} %{std*} %{ansi}\
+ %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs}\
  %{v:-version} %{pg:-p} %{p} %{f*} %{undef}\
  %{Qn:-fno-ident} %{--help:--help}\
  %{--target-help:--target-help}\
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/pr11459-1.c GCC/gcc/testsuite/gcc.dg/pr11459-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/pr11459-1.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/pr11459-1.c	2004-09-26 00:57:33.000000000 +0000
@@ -0,0 +1,6 @@
+/* -ansi -std=c99 should mean -std=c99, but the specs reordered the
+    options.  Bug 11459.  */
+/* { dg-do compile } */
+/* { dg-options "-ansi -std=c99 -pedantic" } */
+
+long long i;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/pr18502-1.c GCC/gcc/testsuite/gcc.dg/pr18502-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/pr18502-1.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/pr18502-1.c	2005-02-02 22:52:34.000000000 +0000
@@ -0,0 +1,7 @@
+/* Test that -trigraphs isn't reordered before -std=gnu99.  Bug
+   18502.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -trigraphs" } */
+
+int a??(2??);

2005-05-01  Joseph S. Myers  <joseph@codesourcery.com>

	PR c/20740
	* c-format.c (init_dynamic_asm_fprintf_info): Give errors, not
	aborts, if __gcc_host_wide_int__ is not properly defined.
	(init_dynamic_diag_info): Give errors, not aborts, if location_t,
	tree or __gcc_host_wide_int__ are not properly defined.

testsuite:
2005-05-01  Joseph S. Myers  <joseph@codesourcery.com>

	PR c/20740
	* gcc.dg/format/asm_fprintf-2.c, gcc.dg/format/asm_fprintf-3.c,
	gcc.dg/format/asm_fprintf-4.c, gcc.dg/format/asm_fprintf-5.c,
	gcc.dg/format/gcc_diag-2.c, gcc.dg/format/gcc_diag-3.c,
	gcc.dg/format/gcc_diag-4.c, gcc.dg/format/gcc_diag-5.c,
	gcc.dg/format/gcc_diag-6.c, gcc.dg/format/gcc_diag-7.c ,
	gcc.dg/format/gcc_diag-8.c, gcc.dg/format/gcc_diag-9.c: New tests.

diff -rupN GCC.orig/gcc/c-format.c GCC/gcc/c-format.c
--- GCC.orig/gcc/c-format.c	2003-12-20 00:00:27.000000000 +0000
+++ GCC/gcc/c-format.c	2005-04-29 22:09:30.000000000 +0000
@@ -2518,9 +2518,27 @@ init_dynamic_asm_fprintf_info (void)
 	 length modifier to work, one must have issued: "typedef
 	 HOST_WIDE_INT __gcc_host_wide_int__;" in one's source code
 	 prior to using that modifier.  */
-      if (!(hwi = maybe_get_identifier ("__gcc_host_wide_int__"))
-	  || !(hwi = DECL_ORIGINAL_TYPE (identifier_global_value (hwi))))
+      hwi = maybe_get_identifier ("__gcc_host_wide_int__");
+      if (!hwi)
+	{
+	  error ("'__gcc_host_wide_int__' is not defined as a type");
+	  return;
+	}
+      hwi = identifier_global_value (hwi);
+      if (!hwi || TREE_CODE (hwi) != TYPE_DECL)
+	{
+	  error ("'__gcc_host_wide_int__' is not defined as a type");
+	  return;
+	}
+      hwi = DECL_ORIGINAL_TYPE (hwi);
+      if (!hwi)
 	abort ();
+      if (hwi != long_integer_type_node && hwi != long_long_integer_type_node)
+	{
+	  error ("'__gcc_host_wide_int__' is not defined as 'long'"
+		 " or 'long long'");
+	  return;
+	}
 
       /* Create a new (writable) copy of asm_fprintf_length_specs.  */
       new_asm_fprintf_length_specs = xmemdup (asm_fprintf_length_specs,
@@ -2563,19 +2581,71 @@ init_dynamic_diag_info (void)
 	 However we don't force a hard ICE because we may see only one
 	 or the other type.  */
       if ((loc = maybe_get_identifier ("location_t")))
-	loc = TREE_TYPE (identifier_global_value (loc));
+	{
+	  loc = identifier_global_value (loc);
+	  if (loc)
+	    {
+	      if (TREE_CODE (loc) != TYPE_DECL)
+		{
+		  error ("'location_t' is not defined as a type");
+		  loc = 0;
+		}
+	      else
+		loc = TREE_TYPE (loc);
+	    }
+	}
 
       /* We need to grab the underlying `union tree_node' so peek into
 	 an extra type level.  */
       if ((t = maybe_get_identifier ("tree")))
-	t = TREE_TYPE (TREE_TYPE (identifier_global_value (t)));
+	{
+	  t = identifier_global_value (t);
+	  if (t)
+	    {
+	      if (TREE_CODE (t) != TYPE_DECL)
+		{
+		  error ("'tree' is not defined as a type");
+		  t = 0;
+		}
+	      else if (TREE_CODE (TREE_TYPE (t)) != POINTER_TYPE)
+		{
+		  error ("'tree' is not defined as a pointer type");
+		  t = 0;
+		}
+	      else
+		t = TREE_TYPE (TREE_TYPE (t));
+	    }
+	}
     
       /* Find the underlying type for HOST_WIDE_INT.  For the %w
 	 length modifier to work, one must have issued: "typedef
 	 HOST_WIDE_INT __gcc_host_wide_int__;" in one's source code
 	 prior to using that modifier.  */
       if ((hwi = maybe_get_identifier ("__gcc_host_wide_int__")))
-	hwi = DECL_ORIGINAL_TYPE (identifier_global_value (hwi));
+	{
+	  hwi = identifier_global_value (hwi);
+	  if (hwi)
+	    {
+	      if (TREE_CODE (hwi) != TYPE_DECL)
+		{
+		  error ("'__gcc_host_wide_int__' is not defined as a type");
+		  hwi = 0;
+		}
+	      else
+		{
+		  hwi = DECL_ORIGINAL_TYPE (hwi);
+		  if (!hwi)
+		    abort ();
+		  if (hwi != long_integer_type_node
+		      && hwi != long_long_integer_type_node)
+		    {
+		      error ("'__gcc_host_wide_int__' is not defined"
+			     " as 'long' or 'long long'");
+		      hwi = 0;
+		    }
+		}
+	    }
+	}
       
       /* Assign the new data for use.  */
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/format/asm_fprintf-2.c GCC/gcc/testsuite/gcc.dg/format/asm_fprintf-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/format/asm_fprintf-2.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/asm_fprintf-2.c	2005-04-29 21:13:15.000000000 +0000
@@ -0,0 +1,9 @@
+/* Test for ICE handling internal formats: bug 20740.  The code did
+   not check that, if the required typedef names had been used as
+   identifiers, they were defined to suitable types.  Test
+   "__gcc_host_wide_int__", not used at all, asm_fprintf format.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+void bar (const char *, ...) __attribute__ ((__format__ (__asm_fprintf__, 1, 2))); /* { dg-error "error: '__gcc_host_wide_int__' is not defined as a type" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/format/asm_fprintf-3.c GCC/gcc/testsuite/gcc.dg/format/asm_fprintf-3.c
--- GCC.orig/gcc/testsuite/gcc.dg/format/asm_fprintf-3.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/asm_fprintf-3.c	2005-04-29 21:13:15.000000000 +0000
@@ -0,0 +1,10 @@
+/* Test for ICE handling internal formats: bug 20740.  The code did
+   not check that, if the required typedef names had been used as
+   identifiers, they were defined to suitable types.  Test
+   "__gcc_host_wide_int__", not defined, asm_fprintf format.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+void foo (int __gcc_host_wide_int__);
+void bar (const char *, ...) __attribute__ ((__format__ (__asm_fprintf__, 1, 2))); /* { dg-error "error: '__gcc_host_wide_int__' is not defined as a type" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/format/asm_fprintf-4.c GCC/gcc/testsuite/gcc.dg/format/asm_fprintf-4.c
--- GCC.orig/gcc/testsuite/gcc.dg/format/asm_fprintf-4.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/asm_fprintf-4.c	2005-04-29 21:13:15.000000000 +0000
@@ -0,0 +1,10 @@
+/* Test for ICE handling internal formats: bug 20740.  The code did
+   not check that, if the required typedef names had been used as
+   identifiers, they were defined to suitable types.  Test
+   "__gcc_host_wide_int__", not a type, asm_fprintf.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+int __gcc_host_wide_int__;
+void bar (const char *, ...) __attribute__ ((__format__ (__asm_fprintf__, 1, 2))); /* { dg-error "error: '__gcc_host_wide_int__' is not defined as a type" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/format/asm_fprintf-5.c GCC/gcc/testsuite/gcc.dg/format/asm_fprintf-5.c
--- GCC.orig/gcc/testsuite/gcc.dg/format/asm_fprintf-5.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/asm_fprintf-5.c	2005-04-29 21:13:15.000000000 +0000
@@ -0,0 +1,10 @@
+/* Test for ICE handling internal formats: bug 20740.  The code did
+   not check that, if the required typedef names had been used as
+   identifiers, they were defined to suitable types.  Test
+   "__gcc_host_wide_int__", bad type, asm_fprintf format.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+typedef int __gcc_host_wide_int__;
+void bar (const char *, ...) __attribute__ ((__format__ (__asm_fprintf__, 1, 2))); /* { dg-error "error: '__gcc_host_wide_int__' is not defined as 'long' or 'long long'" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-2.c GCC/gcc/testsuite/gcc.dg/format/gcc_diag-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-2.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/gcc_diag-2.c	2005-04-29 21:13:15.000000000 +0000
@@ -0,0 +1,10 @@
+/* Test for ICE handling internal formats: bug 20740.  The code did
+   not check that, if the required typedef names had been used as
+   identifiers, they were defined to suitable types.  Test "tree", not
+   defined.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+void foo (int tree);
+void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2)));
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-3.c GCC/gcc/testsuite/gcc.dg/format/gcc_diag-3.c
--- GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-3.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/gcc_diag-3.c	2005-04-29 21:13:15.000000000 +0000
@@ -0,0 +1,10 @@
+/* Test for ICE handling internal formats: bug 20740.  The code did
+   not check that, if the required typedef names had been used as
+   identifiers, they were defined to suitable types.  Test "tree", not
+   a type.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+int tree;
+void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); /* { dg-error "error: 'tree' is not defined as a type" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-4.c GCC/gcc/testsuite/gcc.dg/format/gcc_diag-4.c
--- GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-4.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/gcc_diag-4.c	2005-04-29 21:13:15.000000000 +0000
@@ -0,0 +1,10 @@
+/* Test for ICE handling internal formats: bug 20740.  The code did
+   not check that, if the required typedef names had been used as
+   identifiers, they were defined to suitable types.  Test "tree", not
+   a pointer type.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+typedef int tree;
+void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); /* { dg-error "error: 'tree' is not defined as a pointer type" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-5.c GCC/gcc/testsuite/gcc.dg/format/gcc_diag-5.c
--- GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-5.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/gcc_diag-5.c	2005-04-29 21:13:15.000000000 +0000
@@ -0,0 +1,10 @@
+/* Test for ICE handling internal formats: bug 20740.  The code did
+   not check that, if the required typedef names had been used as
+   identifiers, they were defined to suitable types.  Test
+   "location_t", not defined.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+void foo (int location_t);
+void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2)));
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-6.c GCC/gcc/testsuite/gcc.dg/format/gcc_diag-6.c
--- GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-6.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/gcc_diag-6.c	2005-04-29 21:13:15.000000000 +0000
@@ -0,0 +1,10 @@
+/* Test for ICE handling internal formats: bug 20740.  The code did
+   not check that, if the required typedef names had been used as
+   identifiers, they were defined to suitable types.  Test
+   "location_t", not a type.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+int location_t;
+void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); /* { dg-error "error: 'location_t' is not defined as a type" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-7.c GCC/gcc/testsuite/gcc.dg/format/gcc_diag-7.c
--- GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-7.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/gcc_diag-7.c	2005-04-29 21:13:15.000000000 +0000
@@ -0,0 +1,10 @@
+/* Test for ICE handling internal formats: bug 20740.  The code did
+   not check that, if the required typedef names had been used as
+   identifiers, they were defined to suitable types.  Test
+   "__gcc_host_wide_int__", not defined.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+void foo (int __gcc_host_wide_int__);
+void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2)));
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-8.c GCC/gcc/testsuite/gcc.dg/format/gcc_diag-8.c
--- GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-8.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/gcc_diag-8.c	2005-04-29 21:13:15.000000000 +0000
@@ -0,0 +1,10 @@
+/* Test for ICE handling internal formats: bug 20740.  The code did
+   not check that, if the required typedef names had been used as
+   identifiers, they were defined to suitable types.  Test
+   "__gcc_host_wide_int__", not a type.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+int __gcc_host_wide_int__;
+void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); /* { dg-error "error: '__gcc_host_wide_int__' is not defined as a type" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-9.c GCC/gcc/testsuite/gcc.dg/format/gcc_diag-9.c
--- GCC.orig/gcc/testsuite/gcc.dg/format/gcc_diag-9.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/gcc_diag-9.c	2005-04-29 21:13:15.000000000 +0000
@@ -0,0 +1,10 @@
+/* Test for ICE handling internal formats: bug 20740.  The code did
+   not check that, if the required typedef names had been used as
+   identifiers, they were defined to suitable types.  Test
+   "__gcc_host_wide_int__", bad type.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+typedef int __gcc_host_wide_int__;
+void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); /* { dg-error "error: '__gcc_host_wide_int__' is not defined as 'long' or 'long long'" } */

2005-05-01  Joseph S. Myers  <joseph@codesourcery.com>

	PR c/21213
	* c-decl.c (finish_struct): Don't dereference NULL TYPE_FIELDS of
	transparent union.

testsuite:
2005-05-01  Joseph S. Myers  <joseph@codesourcery.com>

	PR c/21213
	* gcc.dg/transparent-union-3.c: New test.

diff -rupN GCC.orig/gcc/c-decl.c GCC/gcc/c-decl.c
--- GCC.orig/gcc/c-decl.c	2004-08-17 16:24:57.000000000 +0000
+++ GCC/gcc/c-decl.c	2005-04-29 21:07:10.000000000 +0000
@@ -5132,7 +5132,7 @@ finish_struct (tree t, tree fieldlist, t
      make it one, warn and turn off the flag.  */
   if (TREE_CODE (t) == UNION_TYPE
       && TYPE_TRANSPARENT_UNION (t)
-      && TYPE_MODE (t) != DECL_MODE (TYPE_FIELDS (t)))
+      && (!TYPE_FIELDS (t) || TYPE_MODE (t) != DECL_MODE (TYPE_FIELDS (t))))
     {
       TYPE_TRANSPARENT_UNION (t) = 0;
       warning ("union cannot be made transparent");
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/transparent-union-3.c GCC/gcc/testsuite/gcc.dg/transparent-union-3.c
--- GCC.orig/gcc/testsuite/gcc.dg/transparent-union-3.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/transparent-union-3.c	2005-04-29 21:07:10.000000000 +0000
@@ -0,0 +1,22 @@
+/* Test for ICEs on invalid transparent unions (empty or no named
+   members).  Bug 21213.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+enum e { A };
+
+union __attribute__((__transparent_union__)) ue1 { enum e; }; /* { dg-warning "warning: declaration does not declare anything" } */
+/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 9 } */
+union ue2 { enum e; } __attribute__((__transparent_union__)); /* { dg-warning "warning: declaration does not declare anything" } */
+/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 11 } */
+
+union __attribute__((__transparent_union__)) ui1 { int; }; /* { dg-warning "warning: declaration does not declare anything" } */
+/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 14 } */
+union ui2 { int; } __attribute__((__transparent_union__)); /* { dg-warning "warning: declaration does not declare anything" } */
+/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 16 } */
+
+union __attribute__((__transparent_union__)) u1 { };
+/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 19 } */
+union u2 { } __attribute__((__transparent_union__));
+/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 21 } */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]