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 175bd11..d962016 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 e04c940..f9dfb7f 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 b5362b9..05d60eb 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.  */