PATCH c++/19044

Matt Austern austern@apple.com
Sat Dec 18 18:32:00 GMT 2004


Bootstrapped and tested on powerpc-apple-darwin.  OK to commit to 
mainline?

			--Matt

	* decl.c (make_rtl_for_nonlocal_decl): Apply user asm name for a 
builtin named "foo" to "__builtin_foo" as well.

	* g++.dg/ext/builtin6.C: New test.

Index: gcc/cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1342
diff -p -r1.1342 decl.c
*** gcc/cp/decl.c       16 Dec 2004 11:03:21 -0000      1.1342
--- gcc/cp/decl.c       18 Dec 2004 18:29:37 -0000
*************** make_rtl_for_nonlocal_decl (tree decl, t
*** 4644,4650 ****
           DECL_HARD_REGISTER (decl) = 1;
         }
         else
!       set_user_assembler_name (decl, asmspec);
       }

     /* Handle non-variables up front.  */
--- 4644,4658 ----
           DECL_HARD_REGISTER (decl) = 1;
         }
         else
!       {
!         if (TREE_CODE (decl) == FUNCTION_DECL
!             && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
!           {
!             tree builtin = built_in_decls [DECL_FUNCTION_CODE (decl)];
!             set_user_assembler_name (builtin, asmspec);
!           }
!         set_user_assembler_name (decl, asmspec);
!       }
       }

     /* Handle non-variables up front.  */
Index: gcc/testsuite/g++.dg/ext/builtin6.C
===================================================================
RCS file: gcc/testsuite/g++.dg/ext/builtin6.C
diff -N gcc/testsuite/g++.dg/ext/builtin6.C
*** /dev/null   1 Jan 1970 00:00:00 -0000
--- gcc/testsuite/g++.dg/ext/builtin6.C 18 Dec 2004 18:29:39 -0000
***************
*** 0 ****
--- 1,11 ----
+ // PR c++/19044
+ // Verify that alternate asm name for builtin named "foo" also gets
+ // applied to its sibling "__builtin_foo".
+
+ // { dg-do compile }
+
+
+ extern "C" double sin(double) __asm("_fancy_sin");
+
+ double foo(double x) { return __builtin_sin(x); }
+



More information about the Gcc-patches mailing list