aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2011-12-09 22:05:26 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2011-12-09 22:05:26 +0000
commit67fafdd15aaf6ede71ded4054073dbd2aab5b7d9 (patch)
treeb7d95696ada2ba75617979d123bb2a15adb775e5
parent8f420307e03a391b8e4bcd57be36d8d6325c7638 (diff)
downloadgcc-67fafdd15aaf6ede71ded4054073dbd2aab5b7d9.zip
gcc-67fafdd15aaf6ede71ded4054073dbd2aab5b7d9.tar.gz
gcc-67fafdd15aaf6ede71ded4054073dbd2aab5b7d9.tar.bz2
tree.c (build_common_builtin_nodes): Do not use TM_PURE attribute unless language has support for TM.
PR/51291 * tree.c (build_common_builtin_nodes): Do not use TM_PURE attribute unless language has support for TM. * config/i386/i386.c (ix86_init_tm_builtins): Exit gracefully in the absence of TM builtins. From-SVN: r182179
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/i386/i386.c5
-rw-r--r--gcc/testsuite/gfortran.dg/trans-mem-skel.f905
-rw-r--r--gcc/tree.c8
4 files changed, 24 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4cc5072..cb28824 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2011-12-09 Aldy Hernandez <aldyh@redhat.com>
+
+ PR/51291
+ * tree.c (build_common_builtin_nodes): Do not use TM_PURE
+ attribute unless language has support for TM.
+ * config/i386/i386.c (ix86_init_tm_builtins): Exit gracefully in
+ the absence of TM builtins.
+
2011-12-09 Eric Botcazou <ebotcazou@adacore.com>
* gimple-fold.c (gimple_fold_stmt_to_constant_1) <GIMPLE_UNARY_RHS>:
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 1638799..15c6c37 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -27023,6 +27023,11 @@ ix86_init_tm_builtins (void)
if (!flag_tm)
return;
+ /* If there are no builtins defined, we must be compiling in a
+ language without trans-mem support. */
+ if (!builtin_decl_explicit_p (BUILT_IN_TM_LOAD_1))
+ return;
+
/* Use whatever attributes a normal TM load has. */
decl = builtin_decl_explicit (BUILT_IN_TM_LOAD_1);
attrs_load = DECL_ATTRIBUTES (decl);
diff --git a/gcc/testsuite/gfortran.dg/trans-mem-skel.f90 b/gcc/testsuite/gfortran.dg/trans-mem-skel.f90
new file mode 100644
index 0000000..7e56fad
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/trans-mem-skel.f90
@@ -0,0 +1,5 @@
+! { dg-do compile }
+! { dg-options "-fgnu-tm" }
+program foo
+ real x
+end program foo
diff --git a/gcc/tree.c b/gcc/tree.c
index 8f3ac2e..cbe5542 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -9437,6 +9437,7 @@ void
build_common_builtin_nodes (void)
{
tree tmp, ftype;
+ int ecf_flags;
if (!builtin_decl_explicit_p (BUILT_IN_MEMCPY)
|| !builtin_decl_explicit_p (BUILT_IN_MEMMOVE))
@@ -9589,9 +9590,12 @@ build_common_builtin_nodes (void)
its value in the landing pad. */
ftype = build_function_type_list (ptr_type_node,
integer_type_node, NULL_TREE);
+ ecf_flags = ECF_PURE | ECF_NOTHROW | ECF_LEAF;
+ /* Only use TM_PURE if we we have TM language support. */
+ if (builtin_decl_explicit_p (BUILT_IN_TM_LOAD_1))
+ ecf_flags |= ECF_TM_PURE;
local_define_builtin ("__builtin_eh_pointer", ftype, BUILT_IN_EH_POINTER,
- "__builtin_eh_pointer",
- ECF_PURE | ECF_NOTHROW | ECF_LEAF | ECF_TM_PURE);
+ "__builtin_eh_pointer", ecf_flags);
tmp = lang_hooks.types.type_for_mode (targetm.eh_return_filter_mode (), 0);
ftype = build_function_type_list (tmp, integer_type_node, NULL_TREE);