From 4cd76837a875b2c2ef619dd44eca555d487573f6 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 26 Jan 2015 22:28:57 +0100 Subject: [PATCH] re PR middle-end/64421 (Incorrect vector function name generated for log) PR middle-end/64421 * omp-low.c (simd_clone_mangle): If DECL_ASSEMBLER_NAME starts with asterisk, skip the first character. * gcc.dg/vect/pr64421.c: New test. From-SVN: r220137 --- gcc/ChangeLog | 6 +++++ gcc/omp-low.c | 8 ++++--- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.dg/vect/pr64421.c | 36 +++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/vect/pr64421.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cb42a5af02f..f10bfb729a9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-01-26 Jakub Jelinek + + PR middle-end/64421 + * omp-low.c (simd_clone_mangle): If DECL_ASSEMBLER_NAME starts + with asterisk, skip the first character. + 2015-01-26 H.J. Lu PR target/64806 diff --git a/gcc/omp-low.c b/gcc/omp-low.c index da53334b325..182836b3a66 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -12663,9 +12663,11 @@ simd_clone_mangle (struct cgraph_node *node, } pp_underscore (&pp); - pp_string (&pp, - IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl))); - const char *str = pp_formatted_text (&pp); + const char *str = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl)); + if (*str == '*') + ++str; + pp_string (&pp, str); + str = pp_formatted_text (&pp); /* If there already is a SIMD clone with the same mangled name, don't add another one. This can happen e.g. for diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7fabc0396ad..64162b05604 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-01-26 Jakub Jelinek + + PR middle-end/64421 + * gcc.dg/vect/pr64421.c: New test. + 2015-01-26 Tobias Burnus PR fortran/64771 diff --git a/gcc/testsuite/gcc.dg/vect/pr64421.c b/gcc/testsuite/gcc.dg/vect/pr64421.c new file mode 100644 index 00000000000..7e48a8bea47 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr64421.c @@ -0,0 +1,36 @@ +/* PR middle-end/64421 */ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#include "tree-vect.h" + +#pragma omp declare simd linear (y) notinbranch +int foo (int x, int y) __asm ("bar"); + +#pragma omp declare simd linear (y) notinbranch +int +foo (int x, int y) +{ + return x + y; +} + +int a[1024] = { 1, 2 }; + +int +main () +{ + int i; + check_vect (); + #pragma omp simd + for (i = 0; i < 1024; i++) + a[i] = foo (a[i], i); + if (a[0] != 1 || a[1] != 3) + abort (); + for (i = 2; i < 1024; i++) + if (a[i] != i) + abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ -- 2.30.2