New Swedish PO file for 'gcc' (version 8.1-b20180401)

2018-04-15 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

A revised PO file for textual domain 'gcc' has been submitted
by the Swedish team of translators.  The file is available at:

http://translationproject.org/latest/gcc/sv.po

(This file, 'gcc-8.1-b20180401.sv.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/gcc/

Please consider including all of these in your next release, whether
official or a pretest.

Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below.  The tarball may be just a pretest or a
snapshot, it does not even have to compile.  It is just used by the
translators when they need some extra translation context.

The following HTML page has been updated:

http://translationproject.org/domain/gcc.html

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.




[PATCH i386: Check error_mark_node in multiversioning

2018-04-15 Thread H.J. Lu
Since CET is applied to the whole program, it is correct to disallow
-fcf-protection=full without -mcet.  But compiler shouldn't crash.

OK for trunk?

H.J.

gcc/

PR target/85403
* config/i386/i386.c (get_builtin_code_for_version): Check
error_mark_node.

gcc/testsuite/

PR target/85403
* g++.dg/ext/mv1.C: Compile with -fcf-protection=none.
* g++.dg/ext/mv14.C: Likewise.
* g++.dg/ext/mv15.C: Likewise.
* g++.dg/ext/mv16.C: Likewise.
* g++.dg/ext/mv17.C: Likewise.
* g++.dg/ext/mv18.C: Likewise.
* g++.dg/ext/mv19.C: Likewise.
* g++.dg/ext/mv20.C: Likewise.
* g++.dg/ext/mv21.C: Likewise.
* g++.dg/ext/mv22.C: Likewise.
* g++.dg/ext/mv23.C: Likewise.
* g++.dg/ext/mv26.C: Likewise.
* g++.dg/ext/mv6.C: Likewise.
* g++.dg/ext/mvc1.C: Likewise.
* gcc.target/i386/cet-notrack-icf-1.c: Likewise.
* gcc.target/i386/cet-notrack-icf-3.c: Likewise.
* gcc.target/i386/cet-property-2.c: Likewise.
* gcc.target/i386/mvc1.c: Likewise.
* gcc.target/i386/mvc10.c: Likewise.
* gcc.target/i386/mvc11.c: Likewise.
* gcc.target/i386/mvc6.c: Likewise.
* gcc.target/i386/mvc7.c: Likewise.
* gcc.target/i386/mvc8.c: Likewise.
* gcc.target/i386/mvc9.c: Likewise.
* gcc.target/i386/pr81213.c: Likewise.
* gcc.target/i386/pr81214.c: Likewise.
* gcc.target/i386/sse-26.c: Likewise.
* gcc.target/i386/pr85403.c: New test.
---
 gcc/config/i386/i386.c|  2 ++
 gcc/testsuite/g++.dg/ext/mv1.C|  2 +-
 gcc/testsuite/g++.dg/ext/mv14.C   |  2 +-
 gcc/testsuite/g++.dg/ext/mv15.C   |  2 +-
 gcc/testsuite/g++.dg/ext/mv16.C   |  2 +-
 gcc/testsuite/g++.dg/ext/mv17.C   |  2 +-
 gcc/testsuite/g++.dg/ext/mv18.C   |  2 +-
 gcc/testsuite/g++.dg/ext/mv19.C   |  2 +-
 gcc/testsuite/g++.dg/ext/mv20.C   |  2 +-
 gcc/testsuite/g++.dg/ext/mv21.C   |  2 +-
 gcc/testsuite/g++.dg/ext/mv22.C   |  2 +-
 gcc/testsuite/g++.dg/ext/mv23.C   |  2 +-
 gcc/testsuite/g++.dg/ext/mv26.C   |  1 +
 gcc/testsuite/g++.dg/ext/mv6.C|  2 +-
 gcc/testsuite/g++.dg/ext/mvc1.C   |  1 +
 gcc/testsuite/gcc.target/i386/cet-notrack-icf-1.c |  2 +-
 gcc/testsuite/gcc.target/i386/cet-notrack-icf-3.c |  2 +-
 gcc/testsuite/gcc.target/i386/cet-property-2.c|  2 +-
 gcc/testsuite/gcc.target/i386/mvc1.c  |  1 +
 gcc/testsuite/gcc.target/i386/mvc10.c |  1 +
 gcc/testsuite/gcc.target/i386/mvc11.c |  2 +-
 gcc/testsuite/gcc.target/i386/mvc6.c  |  2 +-
 gcc/testsuite/gcc.target/i386/mvc7.c  |  1 +
 gcc/testsuite/gcc.target/i386/mvc8.c  |  2 +-
 gcc/testsuite/gcc.target/i386/mvc9.c  |  2 +-
 gcc/testsuite/gcc.target/i386/pr81213.c   |  1 +
 gcc/testsuite/gcc.target/i386/pr81214.c   |  1 +
 gcc/testsuite/gcc.target/i386/pr85403.c   | 10 ++
 gcc/testsuite/gcc.target/i386/sse-26.c|  2 +-
 29 files changed, 39 insertions(+), 20 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr85403.c

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 6fa5b0add02..8a73fc0d316 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -32344,6 +32344,8 @@ get_builtin_code_for_version (tree decl, tree 
*predicate_list)
  &global_options_set);
 
   gcc_assert (target_node);
+  if (target_node == error_mark_node)
+   return 0;
   new_target = TREE_TARGET_OPTION (target_node);
   gcc_assert (new_target);
   
diff --git a/gcc/testsuite/g++.dg/ext/mv1.C b/gcc/testsuite/g++.dg/ext/mv1.C
index 4eedbff7b23..af81f3aa056 100644
--- a/gcc/testsuite/g++.dg/ext/mv1.C
+++ b/gcc/testsuite/g++.dg/ext/mv1.C
@@ -1,7 +1,7 @@
 /* Test case to check if Multiversioning works.  */
 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
 /* { dg-require-ifunc "" }  */
-/* { dg-options "-O2 -fPIC" } */
+/* { dg-options "-O2 -fPIC -fcf-protection=none" } */
 
 #include 
 
diff --git a/gcc/testsuite/g++.dg/ext/mv14.C b/gcc/testsuite/g++.dg/ext/mv14.C
index 1e7a1619698..82b153b7ebb 100644
--- a/gcc/testsuite/g++.dg/ext/mv14.C
+++ b/gcc/testsuite/g++.dg/ext/mv14.C
@@ -1,7 +1,7 @@
 /* Test case to check if Multiversioning works.  */
 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
 /* { dg-require-ifunc "" }  */
-/* { dg-options "-O2 -fPIC -march=x86-64" } */
+/* { dg-options "-O2 -fPIC -march=x86-64 -fcf-protection=none" } */
 
 #include 
 
diff --git a/gcc/testsuite/g++.dg/ext/mv15.C b/gcc/testsuite/g++.dg/ext/mv15.C
index c0beadf16ea..3d1bf9934dd 100644
--- a/gcc/testsuite/g++.dg/ext/mv15.C
+++ b/gcc/testsu

[PATCH] i386: Add save_stack_nonlocal and restore_stack_nonlocal

2018-04-15 Thread H.J. Lu
Define STACK_SAVEAREA_MODE to hold both shadow stack and stack pointers.
Replace builtin_setjmp_setup and builtin_longjmp with save_stack_nonlocal
and restore_stack_nonlocal to support both builtin setjmp/longjmp as well
as non-local goto in nested functions.

OK for trunk?

H.J.

gcc/

PR target/85397
* config/i386/i386.h (STACK_SAVEAREA_MODE): New.
* config/i386/i386.md (builtin_setjmp_setup): Removed.
(builtin_longjmp): Likewise.
(save_stack_nonlocal): New pattern.
(restore_stack_nonlocal): Likewise.

gcc/testsuite/

PR target/85397
* gcc.dg/torture/pr85397-1.c: New test.
* gcc.target/i386/cet-sjlj-6a.c: Adjusted.
* gcc.target/i386/cet-sjlj-6b.c: Likewise.
---
 gcc/config/i386/i386.h  |  11 +++
 gcc/config/i386/i386.md | 107 +---
 gcc/testsuite/gcc.dg/torture/pr85397-1.c|  29 
 gcc/testsuite/gcc.target/i386/cet-sjlj-6a.c |   4 +-
 gcc/testsuite/gcc.target/i386/cet-sjlj-6b.c |   4 +-
 5 files changed, 92 insertions(+), 63 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/torture/pr85397-1.c

diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index c7f9b4551b3..c45d22cae98 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1943,6 +1943,17 @@ do { 
\
between pointers and any other objects of this machine mode.  */
 #define Pmode (ix86_pmode == PMODE_DI ? DImode : SImode)
 
+/* Supply a definition of STACK_SAVEAREA_MODE for emit_stack_save.
+   NONLOCAL needs space to save both shadow stack and stack pointers.
+
+   FIXME: We only need to save and restore stack pointer in ptr_mode.
+   But expand_builtin_setjmp_setup and expand_builtin_longjmp use Pmode
+   to save and restore stack pointer.  See
+   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84150
+ */
+#define STACK_SAVEAREA_MODE(LEVEL) \
+  ((LEVEL) == SAVE_NONLOCAL ? (TARGET_64BIT ? TImode : DImode) : Pmode)
+
 /* Specify the machine mode that bounds have.  */
 #define BNDmode (ix86_pmode == PMODE_DI ? BND64mode : BND32mode)
 
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 352212094ec..841d0a77ecc 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -18485,29 +18485,6 @@
   "* return output_probe_stack_range (operands[0], operands[2]);"
   [(set_attr "type" "multi")])
 
-/* Additional processing for builtin_setjmp.  Store the shadow stack pointer
-   as a forth element in jmpbuf.  */
-(define_expand "builtin_setjmp_setup"
-  [(match_operand 0 "address_operand")]
-  "TARGET_SHSTK"
-{
-  if (flag_cf_protection & CF_RETURN)
-{
-  rtx mem, reg_ssp;
-
-  mem = gen_rtx_MEM (word_mode,
-plus_constant (Pmode, operands[0],
-   3 * GET_MODE_SIZE (ptr_mode)));
-  reg_ssp = gen_reg_rtx (word_mode);
-  emit_insn (gen_rtx_SET (reg_ssp, const0_rtx));
-  emit_insn ((word_mode == SImode)
-? gen_rdsspsi (reg_ssp)
-: gen_rdsspdi (reg_ssp));
-  emit_move_insn (mem, reg_ssp);
-}
-  DONE;
-})
-
 (define_expand "builtin_setjmp_receiver"
   [(label_ref (match_operand 0))]
   "!TARGET_64BIT && flag_pic"
@@ -18528,19 +18505,46 @@
   DONE;
 })
 
-(define_expand "builtin_longjmp"
-  [(match_operand 0 "address_operand")]
-  "TARGET_SHSTK"
+(define_expand "save_stack_nonlocal"
+  [(set (match_operand 0 "memory_operand")
+(match_operand 1 "register_operand"))]
+  ""
 {
-  rtx fp, lab, stack;
-  rtx flags, jump, noadj_label, inc_label, loop_label;
-  rtx reg_adj, reg_ssp, mem_buf, tmp, clob;
-  machine_mode sa_mode = STACK_SAVEAREA_MODE (SAVE_NONLOCAL);
+  rtx stack_slot;
+  if (TARGET_SHSTK && (flag_cf_protection & CF_RETURN))
+{
+  /* Copy shadow stack pointer to the first slot and stack ppointer
+to the second slot.  */
+  rtx ssp_slot = adjust_address (operands[0], word_mode, 0);
+  stack_slot = adjust_address (operands[0], Pmode, UNITS_PER_WORD);
+  rtx ssp = gen_reg_rtx (word_mode);
+  emit_insn ((word_mode == SImode)
+? gen_rdsspsi (ssp)
+: gen_rdsspdi (ssp));
+  emit_move_insn (ssp_slot, ssp);
+}
+  else
+stack_slot = adjust_address (operands[0], Pmode, 0);
+  emit_move_insn (stack_slot, operands[1]);
+  DONE;
+})
 
-  /* Adjust the shadow stack pointer (ssp) to the value saved in the
- jmp_buf.  The saving was done in the builtin_setjmp_setup.  */
-  if (flag_cf_protection & CF_RETURN)
+(define_expand "restore_stack_nonlocal"
+  [(set (match_operand 0 "register_operand" "")
+   (match_operand 1 "memory_operand" ""))]
+  ""
+{
+  rtx stack_slot;
+  if (TARGET_SHSTK && (flag_cf_protection & CF_RETURN))
 {
+  /* Restore shadow stack pointer from the first slot and stack
+pointer from the second slot.  */
+  rtx ssp_slot = adjust_address (operan

[PATCH] x86: Compile with -fcf-protection=none -mno-cet

2018-04-15 Thread H.J. Lu
These tests must be compiled with -fcf-protection=none -mno-cet.

OK for trunk?

H.J.

* c-c++-common/attr-nocf-check-1.c: Compile with
-fcf-protection=none -mno-cet for x86 targets.
* c-c++-common/attr-nocf-check-3.c: Likewise.
* gcc.dg/march-generic.c: Likewise.
* gcc.target/i386/align-limit.c: Likewise.
* gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
* gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
* gcc.target/i386/ret-thunk-26.c: Likewise.
---
 gcc/testsuite/c-c++-common/attr-nocf-check-1.c  | 1 +
 gcc/testsuite/c-c++-common/attr-nocf-check-3.c  | 1 +
 gcc/testsuite/gcc.dg/march-generic.c| 2 +-
 gcc/testsuite/gcc.target/i386/align-limit.c | 2 +-
 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c   | 2 +-
 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c | 2 +-
 gcc/testsuite/gcc.target/i386/ret-thunk-26.c| 2 +-
 7 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/gcc/testsuite/c-c++-common/attr-nocf-check-1.c 
b/gcc/testsuite/c-c++-common/attr-nocf-check-1.c
index 15f69731b91..4d579136b5a 100644
--- a/gcc/testsuite/c-c++-common/attr-nocf-check-1.c
+++ b/gcc/testsuite/c-c++-common/attr-nocf-check-1.c
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-fcf-protection=none -mno-cet" { target i?86-*-* 
x86_64-*-* } } */
 
 int func (int) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check' 
attribute ignored" } */
 int (*fptr) (int) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check' 
attribute ignored" } */
diff --git a/gcc/testsuite/c-c++-common/attr-nocf-check-3.c 
b/gcc/testsuite/c-c++-common/attr-nocf-check-3.c
index ad1ca7eec9b..da58d560a31 100644
--- a/gcc/testsuite/c-c++-common/attr-nocf-check-3.c
+++ b/gcc/testsuite/c-c++-common/attr-nocf-check-3.c
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-fcf-protection=none -mno-cet" { target i?86-*-* 
x86_64-*-* } } */
 
 int  foo (void) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check' 
attribute ignored" } */
 void (*foo1) (void) __attribute__((nocf_check)); /* { dg-warning "'nocf_check' 
attribute ignored" } */
diff --git a/gcc/testsuite/gcc.dg/march-generic.c 
b/gcc/testsuite/gcc.dg/march-generic.c
index fb5b83c7d74..94237fee0ca 100644
--- a/gcc/testsuite/gcc.dg/march-generic.c
+++ b/gcc/testsuite/gcc.dg/march-generic.c
@@ -1,6 +1,6 @@
 /* { dg-do compile { target i?86-*-* x86_64-*-* } } */
 /* { dg-skip-if "" { *-*-* } { "-march=*" } { "" } } */
-/* { dg-options "-march=generic" } */
+/* { dg-options "-march=generic -fcf-protection=none -mno-cet" } */
 /* { dg-error "'generic' CPU can be used only for '-mtune=' switch" "" { 
target *-*-* } 0 } */
 /* { dg-bogus "march" "" { target *-*-* } 0 } */
 int i;
diff --git a/gcc/testsuite/gcc.target/i386/align-limit.c 
b/gcc/testsuite/gcc.target/i386/align-limit.c
index d3d8dc5656e..2560e7b242f 100644
--- a/gcc/testsuite/gcc.target/i386/align-limit.c
+++ b/gcc/testsuite/gcc.target/i386/align-limit.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -falign-functions=64 -flimit-function-alignment 
-march=amdfam10" } */
+/* { dg-options "-O2 -falign-functions=64 -flimit-function-alignment 
-march=amdfam10 -fcf-protection=none -mno-cet" } */
 /* { dg-final { scan-assembler ".p2align 6,,1" } } */
 /* { dg-final { scan-assembler-not ".p2align 6,,63" } } */
 
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c 
b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
index d53fc887dcc..64c2ff66692 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep 
-fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep 
-fno-pic -fcf-protection=none -mno-cet" } */
 
 void func0 (void);
 void func1 (void);
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c 
b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
index 2b9a33e93dc..ff0138b4878 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep 
-mindirect-branch=thunk-extern -fno-pic" } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep 
-mindirect-branch=thunk-extern -fno-pic -fcf-protection=none -mno-cet" } */
 
 void func0 (void);
 void func1 (void);
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-26.c 
b/gcc/testsuite/gcc.target/i386/ret-thunk-26.c
index 9144e988735..45c823fc369 100644
--- a/gcc/testsuite/gcc.target/i386/ret-thunk-26.c
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-26.c
@@ -1,6 +1,6 @@
 /* PR target/r84530 */
 /* { dg-do run } */
-/* { dg-options 

[PATCH] x86: Compile with -mno-cet/-mno-ibt/-mno-shstk

2018-04-15 Thread H.J. Lu
These tests must be compiled with -mno-cet/-mno-ibt/-mno-shstk.

OK for trunk?

H.J.
---
* c-c++-common/fcf-protection-1.c: Likewise.
* c-c++-common/fcf-protection-2.c: Likewise.
* c-c++-common/fcf-protection-3.c: Likewise.
* c-c++-common/fcf-protection-5.c: Likewise.
* c-c++-common/fcf-protection-6.c: Likewise.
* c-c++-common/fcf-protection-7.c: Likewise.
---
 gcc/testsuite/c-c++-common/fcf-protection-1.c | 1 +
 gcc/testsuite/c-c++-common/fcf-protection-2.c | 1 +
 gcc/testsuite/c-c++-common/fcf-protection-3.c | 1 +
 gcc/testsuite/c-c++-common/fcf-protection-5.c | 1 +
 gcc/testsuite/c-c++-common/fcf-protection-6.c | 2 +-
 gcc/testsuite/c-c++-common/fcf-protection-7.c | 4 ++--
 6 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/c-c++-common/fcf-protection-1.c 
b/gcc/testsuite/c-c++-common/fcf-protection-1.c
index 8e71f47dde0..8bdb3fa20fc 100644
--- a/gcc/testsuite/c-c++-common/fcf-protection-1.c
+++ b/gcc/testsuite/c-c++-common/fcf-protection-1.c
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
 /* { dg-options "-fcf-protection=full" } */
+/* { dg-additional-options "-mno-cet" { target i?86-*-* x86_64-*-* } } */
 /* { dg-error "'-fcf-protection=full' requires Intel CET.*-mcet.*-mibt and 
-mshstk option" "" { target { "i?86-*-* x86_64-*-*" } } 0 } */
 /* { dg-error "'-fcf-protection=full' is not supported for this target" "" { 
target { ! "i?86-*-* x86_64-*-*" } } 0 } */
diff --git a/gcc/testsuite/c-c++-common/fcf-protection-2.c 
b/gcc/testsuite/c-c++-common/fcf-protection-2.c
index d7d6db0e95d..607693fae73 100644
--- a/gcc/testsuite/c-c++-common/fcf-protection-2.c
+++ b/gcc/testsuite/c-c++-common/fcf-protection-2.c
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
 /* { dg-options "-fcf-protection=branch" } */
+/* { dg-additional-options "-mno-cet" { target i?86-*-* x86_64-*-* } } */
 /* { dg-error "'-fcf-protection=branch' requires Intel CET.*-mcet or -mibt 
option" "" { target { "i?86-*-* x86_64-*-*" } } 0 } */
 /* { dg-error "'-fcf-protection=branch' is not supported for this target" "" { 
target { ! "i?86-*-* x86_64-*-*" } } 0 } */
diff --git a/gcc/testsuite/c-c++-common/fcf-protection-3.c 
b/gcc/testsuite/c-c++-common/fcf-protection-3.c
index 5b903c5fa51..398df8bedea 100644
--- a/gcc/testsuite/c-c++-common/fcf-protection-3.c
+++ b/gcc/testsuite/c-c++-common/fcf-protection-3.c
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
 /* { dg-options "-fcf-protection=return" } */
+/* { dg-additional-options "-mno-cet" { target i?86-*-* x86_64-*-* } } */
 /* { dg-error "'-fcf-protection=return' requires Intel CET.*-mcet or -mshstk 
option" "" { target { "i?86-*-* x86_64-*-*" } } 0 } */
 /* { dg-error "'-fcf-protection=return' is not supported for this target" "" { 
target { ! "i?86-*-* x86_64-*-*" } } 0 } */
diff --git a/gcc/testsuite/c-c++-common/fcf-protection-5.c 
b/gcc/testsuite/c-c++-common/fcf-protection-5.c
index d7a67801e2e..d22b359a8f7 100644
--- a/gcc/testsuite/c-c++-common/fcf-protection-5.c
+++ b/gcc/testsuite/c-c++-common/fcf-protection-5.c
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
 /* { dg-options "-fcf-protection" } */
+/* { dg-additional-options "-mno-cet" { target { i?86-*-* x86_64-*-* } } } */
 /* { dg-error "'-fcf-protection=full' requires Intel CET.*-mcet.*-mibt and 
-mshstk option" "" { target { "i?86-*-* x86_64-*-*" } } 0 } */
 /* { dg-error "'-fcf-protection=full' is not supported for this target" "" { 
target { ! "i?86-*-* x86_64-*-*" } } 0 } */
diff --git a/gcc/testsuite/c-c++-common/fcf-protection-6.c 
b/gcc/testsuite/c-c++-common/fcf-protection-6.c
index 532e76e6915..e1d1df2ffd6 100644
--- a/gcc/testsuite/c-c++-common/fcf-protection-6.c
+++ b/gcc/testsuite/c-c++-common/fcf-protection-6.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
 /* { dg-options "-fcf-protection=branch" } */
-/* { dg-additional-options "-mshstk" { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-additional-options "-mshstk -mno-ibt" { target { i?86-*-* x86_64-*-* } 
} } */
 /* { dg-error "'-fcf-protection=branch' requires Intel CET.*-mcet or -mibt 
option" "" { target { "i?86-*-* x86_64-*-*" } } 0 } */
 /* { dg-error "'-fcf-protection=branch' is not supported for this target" "" { 
target { ! "i?86-*-* x86_64-*-*" } } 0 } */
diff --git a/gcc/testsuite/c-c++-common/fcf-protection-7.c 
b/gcc/testsuite/c-c++-common/fcf-protection-7.c
index 4c879692708..510fc1970da 100644
--- a/gcc/testsuite/c-c++-common/fcf-protection-7.c
+++ b/gcc/testsuite/c-c++-common/fcf-protection-7.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-fcf-protection=return" } */
-/* { dg-additional-options "-mibt" { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-fcf-protection=return -mno-cet" } */
+/* { dg-additional-options "-mibt -mno-shstk" { target { i?86-*-* x86_64-*-* } 
} } */
 /* { dg-error "'-fcf-protection=return' requires Intel CET.*-mcet or -mshstk 
option" "" { target { "i?86-*-* x86_64-*-*" } } 0 } */
 /* { dg-error "'-fcf-protection=return' is not supported for this target

[PATCH] x86/cet: Properly output labels in property note section

2018-04-15 Thread H.J. Lu
Replace ASM_OUTPUT_LABEL with fprintf so that internal labels in property
note section are unchanged -fleading-underscore.

OK for trunk?

H.J.
---
gcc/

PR target/85404
* config/i386/cet.c (file_end_indicate_exec_stack_and_cet):
Replace ASM_OUTPUT_LABEL with fprintf.

gcc/testsuite/

PR target/85404
* gcc.target/i386/pr85404.c: New test.
---
 gcc/config/i386/cet.c   | 10 +-
 gcc/testsuite/gcc.target/i386/pr85404.c |  6 ++
 2 files changed, 11 insertions(+), 5 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr85404.c

diff --git a/gcc/config/i386/cet.c b/gcc/config/i386/cet.c
index 4a1e013fdde..d5bbe8b7fe8 100644
--- a/gcc/config/i386/cet.c
+++ b/gcc/config/i386/cet.c
@@ -57,20 +57,20 @@ file_end_indicate_exec_stack_and_cet (void)
   fprintf (asm_out_file, ASM_LONG " 4f - 1f\n");
   /* note type: NT_GNU_PROPERTY_TYPE_0.  */
   fprintf (asm_out_file, ASM_LONG " 5\n");
-  ASM_OUTPUT_LABEL (asm_out_file, "0");
+  fprintf (asm_out_file, "0:\n");
   /* vendor name: "GNU".  */
   fprintf (asm_out_file, STRING_ASM_OP " \"GNU\"\n");
-  ASM_OUTPUT_LABEL (asm_out_file, "1");
+  fprintf (asm_out_file, "1:\n");
   ASM_OUTPUT_ALIGN (asm_out_file, p2align);
   /* pr_type: GNU_PROPERTY_X86_FEATURE_1_AND.  */
   fprintf (asm_out_file, ASM_LONG " 0xc002\n");
   /* pr_datasz.  */\
   fprintf (asm_out_file, ASM_LONG " 3f - 2f\n");
-  ASM_OUTPUT_LABEL (asm_out_file, "2");
+  fprintf (asm_out_file, "2:\n");
   /* GNU_PROPERTY_X86_FEATURE_1_XXX.  */
   fprintf (asm_out_file, ASM_LONG " 0x%x\n", feature_1);
-  ASM_OUTPUT_LABEL (asm_out_file, "3");
+  fprintf (asm_out_file, "3:\n");
   ASM_OUTPUT_ALIGN (asm_out_file, p2align);
-  ASM_OUTPUT_LABEL (asm_out_file, "4");
+  fprintf (asm_out_file, "4:\n");
 }
 }
diff --git a/gcc/testsuite/gcc.target/i386/pr85404.c 
b/gcc/testsuite/gcc.target/i386/pr85404.c
new file mode 100644
index 000..bbf456ec024
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr85404.c
@@ -0,0 +1,6 @@
+/* { dg-do assemble } */
+/* { dg-options "-fleading-underscore -mcet -fcf-protection" } */
+
+void func(void) __asm("_func");
+void _func(int x) {}
+void func(void) {}
-- 
2.14.3



[PATCH] PR 85075, Fix PowerPC __float182/__ibm128 types and mangling

2018-04-15 Thread Michael Meissner
PR target/85075 shows that there are some problems with the types for the 3
128-bit floating point types on the PowerPC:

__float128  (and _Float128 in C, IEEE 128-bit)
__ieee128   (IBM extended double)
long double (either IEEE 128-bit or IBM extended double)

With GCC 8, we are beginning the transition of long double from the IBM
extended double format to IEEE 128-bit.

I implemented __float128 and __ieee128 initially as being separate types when
the long double format was the other type, and mapped to long double when the
long double format was the same as the type.

However, the use of C++ templates and overloaded functions within classes shows
that we really need to have 3 separate types.  Each type needs to have
different mangling.

Since __float128 and __ibm128 are now always separate types, I relaxed the
restriction that __ibm128 can only be used if -mlong-double-128.

In developing this patch, Segher noticed that the mangling for __float128
violated the mangling standards.  This patch includes a change to use a more
official mangling (u10__float128).  This means that GCC 8 will not be able to
link with C++ functions that pass or return __float128 values compiled with GCC
6 or GCC 7.  I have put in a warning if __float128 is mangled.  The warning can
be silenced by using -Wno-psabi.

In addition, when I built this on big endian system, the changes exposed a
latent bug with the way __builtin_packlongdouble was done when it tried to
support the first argument overlapping with the result.  I have removed the
code to support overlapping input/output for this builtin.  I imagine that we
will need to add __builtin_packieee128 and __builtin_unpackieee128 as well in
the future (or make __builtin_{,un}packlongdouble support all three types).

The manglings that are now used are:

For -mabi=ieeelongdouble:

__float128  "u10__float128"
__ibm128"u8__ibm128"
long double "u9__ieee128"

For -mabi=ibmlongdouble:

__float128  "u10__float128"
__ibm128"u8__ibm128"
long double "g"

For -mlong-double-64:

__float128  "u10__float128"
__ibm128"u8__ibm128"
long double "e"

I have tested these patches on a little endian power8 system and a big endian
power7 system (both 32/64-bit).  I also tested a previous version of the patch
on a big endian power8 system (both 32/64-bit).  There were no regressions.

Can I apply these patches to the GCC 8 trunk?

[gcc]
2018-04-15  Michael Meissner  

PR target/85075
* config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): __ibm128 is
now a separate type, don't #define __ibm128 as long double.
* config/rs6000/rs6000.c (rs6000_init_builtins): Make __ibm128 a
separate type on systems that support IEEE 128-bit floating point.
(rs6000_mangle_type): Use separate manglings for __ibm128 and
__float128.  Change __float128 mangling from U10__float128 to
u10__float128.  Issue a warning that the mangling has changed in
GCC 8.
* config/rs6000/rs6000.md (pack): Do not try handle a pack
where the inputs overlap with the output.

[gcc/testsuite]
2018-04-15  Michael Meissner  

PR target/85075
* g++.dg/pr85075-1.C: New tests.  Make sure that __float128,
__ibm128, and long double are different types, and that you can
mix them in templates and with overloaded functions.  Test all 3
different long dobule variants (IEEE 128 bit, IBM 128 bit, and 64
bit).
* g++.dg/pr85075-2.C: Likewise.
* g++.dg/pr85075-3.C: Likewise.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797
Index: gcc/config/rs6000/rs6000-c.c
===
--- gcc/config/rs6000/rs6000-c.c(revision 259376)
+++ gcc/config/rs6000/rs6000-c.c(working copy)
@@ -617,8 +617,6 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfi
 builtin_define ("__RSQRTEF__");
   if (TARGET_FLOAT128_TYPE)
 builtin_define ("__FLOAT128_TYPE__");
-  if (TARGET_LONG_DOUBLE_128 && FLOAT128_IBM_P (TFmode))
-builtin_define ("__ibm128=long double");
 #ifdef TARGET_LIBC_PROVIDES_HWCAP_IN_TCB
   builtin_define ("__BUILTIN_CPU_SUPPORTS__");
 #endif
Index: gcc/config/rs6000/rs6000.c
===
--- gcc/config/rs6000/rs6000.c  (revision 259376)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -16994,28 +16994,22 @@ rs6000_init_builtins (void)
  For IEEE 128-bit floating point, always create the type __ieee128.  If the
  user used -mfloat128, rs6000-c.c will create a define from __float128 to
  __ieee128.  */
-  if (TARGET_LONG_DOUBLE_128 && FLOAT128_IEEE_P (TFmode))
+  if (TARGET_FLOAT128_TYPE)
 {
   ibm128_float_type_node = make_node (REAL_

Re: [PATCH] PR 85075, Fix PowerPC __float182/__ibm128 types and mangling

2018-04-15 Thread Michael Meissner
I should mention that the x86_64 port has the same issue with mangling if you
use the -mlong-double-128 option, since __float128 and long double use the same
mangling.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797



[PATCH, testsuite] Fix powerpc-specific portions of PR85326

2018-04-15 Thread Bill Schmidt
Hi,

This test fixes the part of PR85326 that involves powerpc test cases.
It removes support for .C tests in gcc.target/powerpc and moves the
one .C test from that directory to g++.dg with target constraints.
Tested on powerpc64le-linux-gnu.  Okay for trunk?

Thanks,
Bill


[gcc/testsuite]

2018-04-15  Bill Schmidt  

PR testsuite/85326
* g++.dg/undef-bool-1.C:  New file.
* gcc.target/powerpc/powerpc.exp:  Remove .C support.
* gcc.target/powerpc/undef-bool-1.C:  Remove file.


Index: gcc/testsuite/g++.dg/undef-bool-1.C
===
--- gcc/testsuite/g++.dg/undef-bool-1.C (nonexistent)
+++ gcc/testsuite/g++.dg/undef-bool-1.C (working copy)
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-options "-O2 -std=c++11 -DNO_WARN_X86_INTRINSICS" } */
+
+/* Test to ensure that "bool" gets undef'd in xmmintrin.h when
+   we require strict ANSI.  */
+
+#include 
+
+bool foo (int x)
+{
+  return x == 2;
+}
+
Index: gcc/testsuite/gcc.target/powerpc/powerpc.exp
===
--- gcc/testsuite/gcc.target/powerpc/powerpc.exp(revision 259389)
+++ gcc/testsuite/gcc.target/powerpc/powerpc.exp(working copy)
@@ -35,7 +35,7 @@ if ![info exists DEFAULT_CFLAGS] then {
 dg-init
 
 # Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
"" $DEFAULT_CFLAGS
 
 set SAVRES_TEST_OPTS [list -Os -O2 {-Os -mno-multiple} {-O2 -mno-multiple}]
Index: gcc/testsuite/gcc.target/powerpc/undef-bool-1.C
===
--- gcc/testsuite/gcc.target/powerpc/undef-bool-1.C (revision 259389)
+++ gcc/testsuite/gcc.target/powerpc/undef-bool-1.C (nonexistent)
@@ -1,13 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -std=c++11 -DNO_WARN_X86_INTRINSICS" } */
-
-/* Test to ensure that "bool" gets undef'd in xmmintrin.h when
-   we require strict ANSI.  */
-
-#include 
-
-bool foo (int x)
-{
-  return x == 2;
-}
-



Re: [PATCH, testsuite] Fix powerpc-specific portions of PR85326

2018-04-15 Thread Jakub Jelinek
On Sun, Apr 15, 2018 at 04:53:27PM -0500, Bill Schmidt wrote:
> 2018-04-15  Bill Schmidt  
> 
>   PR testsuite/85326
>   * g++.dg/undef-bool-1.C:  New file.

Tests really shouldn't be added to g++.dg/ directly, but to subdirectories
thereof.
In this case, I think g++.dg/ext/undef-bool-1.C is the right location.
And see below.

Also, just a single space in between : and description in the ChangeLog
file.  Otherwise LGTM, but please wait for PowerPC maintainer ack.

>   * gcc.target/powerpc/powerpc.exp:  Remove .C support.
>   * gcc.target/powerpc/undef-bool-1.C:  Remove file.
> 
> 
> Index: gcc/testsuite/g++.dg/undef-bool-1.C
> ===
> --- gcc/testsuite/g++.dg/undef-bool-1.C   (nonexistent)
> +++ gcc/testsuite/g++.dg/undef-bool-1.C   (working copy)
> @@ -0,0 +1,13 @@
> +/* { dg-do compile { target { powerpc*-*-* } } } */
> +/* { dg-options "-O2 -std=c++11 -DNO_WARN_X86_INTRINSICS" } */

g++.dg/ tests are cycled through some or all -std= options, so
rather than -std=c++11 you should require effective target c++11,
or if you want to run it for -std=c++11 only and not others, c++11only.
Though in this testcase I don't see a reason why it wouldn't work even with
c++14, c++17 or c++2a.

Jakub


Re: [PATCH, testsuite] Fix powerpc-specific portions of PR85326

2018-04-15 Thread Bill Schmidt
On Apr 15, 2018, at 5:50 PM, Jakub Jelinek  wrote:
> 
> On Sun, Apr 15, 2018 at 04:53:27PM -0500, Bill Schmidt wrote:
>> 2018-04-15  Bill Schmidt  
>> 
>>  PR testsuite/85326
>>  * g++.dg/undef-bool-1.C:  New file.
> 
> Tests really shouldn't be added to g++.dg/ directly, but to subdirectories
> thereof.
> In this case, I think g++.dg/ext/undef-bool-1.C is the right location.
> And see below.
> 
> Also, just a single space in between : and description in the ChangeLog
> file.  Otherwise LGTM, but please wait for PowerPC maintainer ack.
> 
>>  * gcc.target/powerpc/powerpc.exp:  Remove .C support.
>>  * gcc.target/powerpc/undef-bool-1.C:  Remove file.
>> 
>> 
>> Index: gcc/testsuite/g++.dg/undef-bool-1.C
>> ===
>> --- gcc/testsuite/g++.dg/undef-bool-1.C  (nonexistent)
>> +++ gcc/testsuite/g++.dg/undef-bool-1.C  (working copy)
>> @@ -0,0 +1,13 @@
>> +/* { dg-do compile { target { powerpc*-*-* } } } */
>> +/* { dg-options "-O2 -std=c++11 -DNO_WARN_X86_INTRINSICS" } */
> 
> g++.dg/ tests are cycled through some or all -std= options, so
> rather than -std=c++11 you should require effective target c++11,
> or if you want to run it for -std=c++11 only and not others, c++11only.
> Though in this testcase I don't see a reason why it wouldn't work even with
> c++14, c++17 or c++2a.

OK, agreed on all fronts.  Segher, okay with these changes?

Thanks,
Bill

> 
>   Jakub
> 



Re: [PATCH, testsuite] Fix powerpc-specific portions of PR85326

2018-04-15 Thread Segher Boessenkool
On Sun, Apr 15, 2018 at 06:08:44PM -0500, Bill Schmidt wrote:
> On Apr 15, 2018, at 5:50 PM, Jakub Jelinek  wrote:
> > 
> > On Sun, Apr 15, 2018 at 04:53:27PM -0500, Bill Schmidt wrote:
> >> 2018-04-15  Bill Schmidt  
> >> 
> >>PR testsuite/85326
> >>* g++.dg/undef-bool-1.C:  New file.
> > 
> > Tests really shouldn't be added to g++.dg/ directly, but to subdirectories
> > thereof.
> > In this case, I think g++.dg/ext/undef-bool-1.C is the right location.
> > And see below.
> > 
> > Also, just a single space in between : and description in the ChangeLog
> > file.  Otherwise LGTM, but please wait for PowerPC maintainer ack.
> > 
> >>* gcc.target/powerpc/powerpc.exp:  Remove .C support.
> >>* gcc.target/powerpc/undef-bool-1.C:  Remove file.
> >> 
> >> 
> >> Index: gcc/testsuite/g++.dg/undef-bool-1.C
> >> ===
> >> --- gcc/testsuite/g++.dg/undef-bool-1.C(nonexistent)
> >> +++ gcc/testsuite/g++.dg/undef-bool-1.C(working copy)
> >> @@ -0,0 +1,13 @@
> >> +/* { dg-do compile { target { powerpc*-*-* } } } */
> >> +/* { dg-options "-O2 -std=c++11 -DNO_WARN_X86_INTRINSICS" } */
> > 
> > g++.dg/ tests are cycled through some or all -std= options, so
> > rather than -std=c++11 you should require effective target c++11,
> > or if you want to run it for -std=c++11 only and not others, c++11only.
> > Though in this testcase I don't see a reason why it wouldn't work even with
> > c++14, c++17 or c++2a.
> 
> OK, agreed on all fronts.  Segher, okay with these changes?

Sure!  But does it even need c++11?  Maybe something in the headers does?
(/me tries...  Seems to work fine with -std=c++98, too?)

Thanks for the patch,


Segher


Re: [PATCH, testsuite] Fix powerpc-specific portions of PR85326

2018-04-15 Thread Bill Schmidt
On Apr 15, 2018, at 6:29 PM, Segher Boessenkool  
wrote:
> 
> On Sun, Apr 15, 2018 at 06:08:44PM -0500, Bill Schmidt wrote:
>> On Apr 15, 2018, at 5:50 PM, Jakub Jelinek  wrote:
>>> 
>>> On Sun, Apr 15, 2018 at 04:53:27PM -0500, Bill Schmidt wrote:
 2018-04-15  Bill Schmidt  
 
PR testsuite/85326
* g++.dg/undef-bool-1.C:  New file.
>>> 
>>> Tests really shouldn't be added to g++.dg/ directly, but to subdirectories
>>> thereof.
>>> In this case, I think g++.dg/ext/undef-bool-1.C is the right location.
>>> And see below.
>>> 
>>> Also, just a single space in between : and description in the ChangeLog
>>> file.  Otherwise LGTM, but please wait for PowerPC maintainer ack.
>>> 
* gcc.target/powerpc/powerpc.exp:  Remove .C support.
* gcc.target/powerpc/undef-bool-1.C:  Remove file.
 
 
 Index: gcc/testsuite/g++.dg/undef-bool-1.C
 ===
 --- gcc/testsuite/g++.dg/undef-bool-1.C(nonexistent)
 +++ gcc/testsuite/g++.dg/undef-bool-1.C(working copy)
 @@ -0,0 +1,13 @@
 +/* { dg-do compile { target { powerpc*-*-* } } } */
 +/* { dg-options "-O2 -std=c++11 -DNO_WARN_X86_INTRINSICS" } */
>>> 
>>> g++.dg/ tests are cycled through some or all -std= options, so
>>> rather than -std=c++11 you should require effective target c++11,
>>> or if you want to run it for -std=c++11 only and not others, c++11only.
>>> Though in this testcase I don't see a reason why it wouldn't work even with
>>> c++14, c++17 or c++2a.
>> 
>> OK, agreed on all fronts.  Segher, okay with these changes?
> 
> Sure!  But does it even need c++11?  Maybe something in the headers does?
> (/me tries...  Seems to work fine with -std=c++98, too?)

Agreed, there shouldn't be a need to check it so long as we're guaranteed
to have it tested for c++11.  I'll remove the option.

Thanks!

Bill
> 
> Thanks for the patch,
> 
> 
> Segher



[PATCH, rs6000] Fix PR85080

2018-04-15 Thread Bill Schmidt
Hi,

PR85080 identifies a test case that started failing last year when
an improvement was made to the vectorizer.  The failure turns out to
be appropriate.  The test used to not expect the loop in the first
function to be vectorized, because the cost of potentially unaligned
loads made this unprofitable.  However, with Power8 and later hardware,
this is no longer the case.  This patch adjusts the test to only check
its results for targets that have inefficient unaligned loads.

Tested on powerpc64le-linux-gnu (POWER8) and powerpc64-linux-gnu
(POWER7).  Is this okay for trunk?

Thanks,
Bill


[gcc/testsuite]

2018-04-16  Bill Schmidt  

PR target/85080
* gcc.dg/vect/costmodel/ppc/costmodel-pr37194.c: Skip dump checks
if the target supports efficient unaligned storage accesses.

Index: gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-pr37194.c
===
--- gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-pr37194.c (revision 
259389)
+++ gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-pr37194.c (working copy)
@@ -22,6 +22,6 @@ ggSpectrum_Set20(float * data, float d)
   data[i] = d;
 }
 
-/* { dg-final { scan-tree-dump-times "vectorization not profitable" 1 "vect" } 
} */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorization not profitable" 1 "vect" { 
target { ! vect_hw_misalign } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { 
! vect_hw_misalign } } } } */