varasm.c (default_function_rdodata_section): Make sure to pass along a decl for a...
authorMark Mitchell <mark@codesourcery.com>
Wed, 15 Sep 2004 22:16:33 +0000 (22:16 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 15 Sep 2004 22:16:33 +0000 (22:16 +0000)
* varasm.c (default_function_rdodata_section): Make sure to pass
along a decl for a link-once section.

* g++.dg/opt/switch1.C: New test.

From-SVN: r87569

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/switch1.C [new file with mode: 0644]
gcc/varasm.c

index 175bd11e046263c2157eb3606373067d8700ef91..d9620165672c51f22c961255e4feae932bbdcc34 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-15  Mark Mitchell  <mark@codesourcery.com>
+
+       * varasm.c (default_function_rdodata_section): Make sure to pass
+       along a decl for a link-once section.
+
 2004-09-15  Richard Henderson  <rth@redhat.com>
 
        * tree-ssa-operands.c (add_call_clobber_ops): Fix unused variable
index e04c94049e0778c08cb44f3a37b840b394a858e1..f9dfb7f6751c5ce331ee84d3a1f76480ec4390d0 100644 (file)
@@ -1,3 +1,7 @@
+2004-09-15  Mark Mitchell  <mark@codesourcery.com>
+
+       * g++.dg/opt/switch1.C: New test.
+
 2004-09-15  Joseph S. Myers  <jsm@polyomino.org.uk>
 
        * g++.dg/ext/member-attr.C, g++.dg/warn/deprecated.C,
diff --git a/gcc/testsuite/g++.dg/opt/switch1.C b/gcc/testsuite/g++.dg/opt/switch1.C
new file mode 100644 (file)
index 0000000..c21630d
--- /dev/null
@@ -0,0 +1,23 @@
+// { dg-options "-O1" }
+
+template <typename T>
+int f(T t) {
+  switch (t) {
+  case 1:
+    return 5;
+  case 2:
+    return 6;
+  case 3:
+    return -4;
+  case 4:
+    return 8;
+  case 5:
+    return 12;
+  case 6:
+    return 13;
+  default:
+    return -27;
+  }
+}
+
+template int f(int);
index b5362b920016a34217524818b15e49137fd2cb6b..05d60eb44d152e305761c194508f29dd0be2ab10 100644 (file)
@@ -600,7 +600,7 @@ default_function_rodata_section (tree decl)
 
          memcpy (rname, name, len);
          rname[14] = 'r';
-         named_section_flags (rname, SECTION_LINKONCE);
+         named_section_real (rname, SECTION_LINKONCE, decl);
          return;
        }
       /* For .text.foo we want to use .rodata.foo.  */