[Bug fortran/85599] invalid optimization: function not always evaluated in logical expression

2018-05-01 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85599

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org ---
(In reply to janus from comment #0)
> Consider the following test case:
> 
> 
> program lazy
> 
>logical :: flag
> 
>flag = .false.
>flag = check() .and. flag  ! 'check' is executed as expected
>flag = flag .and. check()  ! bug: 'check' is not executed
> 
> contains
> 
>logical function check()
>   integer, save :: i = 1
>   print *, "check", i
>   i = i + 1
>   check = .true.
>end function
> 
> end
> 
> 
> The problem here is that gfortran executes the function 'check' only once,
> although it should be executed twice AFAICS.
> 
> Optimizing out the function call might be valid for a PURE function, but for
> an impure one with side effects, I don't think this is allowed.
> 
> Both ifort and flang execute the function twice. For gfortran, the
> optimization level does not seem to influence the result: -O0 and -O3 behave
> in the same way.
> 
> I tried with gfortran versions 5, 6, 7 and 8, which all exhibit the same
> buggy behavior.

The behavior may not be buggy, and it's best not to depend
on side-effects.  From F2018,

10.1.5.4.2 Evaluation of logical intrinsic operations

  Once the interpretation of a logical intrinsic operation is
  established, the processor may evaluate any other expression
  that is logically equivalent, provided that the integrity of
  parentheses in any expression is not violated.

  Two expressions of type logical are logically equivalent
  if their values are equal for all possible values of their
  primaries.

With 'flag = .false.', gfortran can determine that 
check()'s return value is irrelevant.  So, the
the values of 'flag .and. check()' and 'flag' are
logically equivalent.

Note, 'check() .and. flag' is logically equivalent
to 'flag', but the standard does not require any order
in the evaluation of op1 and op2 in a binary operation.

Also, note that this is my interpretation.  I could
be wrong.

[Bug fortran/85603] New: ICE with character array substring assignment

2018-05-01 Thread w6ws at earthlink dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85603

Bug ID: 85603
   Summary: ICE with character array substring assignment
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: w6ws at earthlink dot net
  Target Milestone: ---

The following test case causes an ICE.  First noticed with v5.4, but also
happens with v4.8 and a 4/26/2018 snapshot of v9.0.0.  Intel and NAG compile
and run this.  PGI v17.10 also gets an ICE...:

program strlen_bug
  implicit none

  character(:), allocatable :: strings(:)
  integer :: maxlen

  strings = [ character(32) ::  &
  'short',  &
  'somewhat longer' ]
  maxlen = maxval (len_trim (strings))
  print *, 'max length =', maxlen
  ! causes ICE !
  strings = strings(:)(:maxlen)
  print *, strings

end program

wws@w6ws-4:/rootsda5/home/wws/fortran/array_cons$
/usr/local/gcc-trunk/bin/gfortran --version
GNU Fortran (GCC) 9.0.0 20180426 (experimental)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

wws@w6ws-4:/rootsda5/home/wws/fortran/array_cons$
/usr/local/gcc-trunk/bin/gfortran strlen_bug.f90
strlen_bug.f90:13:0:

   strings = strings(:)(:maxlen)

internal compiler error: Segmentation fault
0xce260f crash_signal
../../gcc-trunk/gcc/toplev.c:325
0x7722a7 gfc_alloc_allocatable_for_assignment(gfc_loopinfo*, gfc_expr*,
gfc_expr*)
../../gcc-trunk/gcc/fortran/trans-array.c:9915
0x7a3c24 gfc_trans_assignment_1
../../gcc-trunk/gcc/fortran/trans-expr.c:10329
0x754537 trans_code
../../gcc-trunk/gcc/fortran/trans.c:1828
0x7e7b2f gfc_trans_block_construct(gfc_code*)
../../gcc-trunk/gcc/fortran/trans-stmt.c:2058
0x754327 trans_code
../../gcc-trunk/gcc/fortran/trans.c:1924
0x788f45 gfc_generate_function_code(gfc_namespace*)
../../gcc-trunk/gcc/fortran/trans-decl.c:6507
0x7081d0 translate_all_program_units
../../gcc-trunk/gcc/fortran/parse.c:6121
0x7081d0 gfc_parse_file()
../../gcc-trunk/gcc/fortran/parse.c:6324
0x75107f gfc_be_parse_file
../../gcc-trunk/gcc/fortran/f95-lang.c:204
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
wws@w6ws-4:/rootsda5/home/wws/fortran/array_cons$

[Bug middle-end/85602] New: regression with strncat and -Wall in GCC 8

2018-05-01 Thread eggert at gnu dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85602

Bug ID: 85602
   Summary: regression with strncat and -Wall in GCC 8
   Product: gcc
   Version: 8.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: eggert at gnu dot org
  Target Milestone: ---

Created attachment 44051
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44051=edit
test program illustrating the regression

I ran into some problems building GNU Coreutils with gcc (GCC) 8.0.1 20180324
(Red Hat 8.0.1-0.20) and isolated it to the attached program w.c. The command
"gcc -Wall w.c" reports:

w.c: In function ‘main’:
w.c:11:35: warning: argument to ‘sizeof’ in ‘strncat’ call is the same
expression as the source; did you mean to use the size of the destination?
[-Wsizeof-pointer-memaccess]
   strncat (buf, u.ut_user, sizeof u.ut_user);

This diagnostic is quite wrong, and propagates confusion about strncat. Unlike
strncpy, strncat does not zero-fill the destination, and it is almost always
incorrect to do as GCC suggests which is to specify the size of the destination
as the third argument.

The source code is correct as-is: it is one of the few places where strncat is
the right function to use, as strncat was designed for struct utmp and similar
data structures. GCC 7 does not warn about this usage, and GCC 8 should not
warn either.

[Bug c++/81420] When a reference is bound to a member in the base of a temporary, lifetime of the temporary is not extended

2018-05-01 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81420

Jason Merrill  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jason at gcc dot gnu.org

[Bug c++/85600] [9 Regression] CPU2006 471.omnetpp fails starting with r259771

2018-05-01 Thread pthaugen at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85600

Pat Haugen  changed:

   What|Removed |Added

  Known to work||8.0
Summary|CPU2006 471.omnetpp fails   |[9 Regression] CPU2006
   |starting with r259771   |471.omnetpp fails starting
   ||with r259771
  Known to fail||9.0

--- Comment #3 from Pat Haugen  ---
Benchmark fails same way with no optimization.

[Bug c++/85580] [8 Regression] "conflicting C language linkage declaration" warning for variables with identical names in `extern "C"` functions

2018-05-01 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85580

Andrew Pinski  changed:

   What|Removed |Added

 CC||andres at anarazel dot de

--- Comment #6 from Andrew Pinski  ---
*** Bug 85601 has been marked as a duplicate of this bug. ***

[Bug c++/85601] [8 Regression] anonymous struct & union namespace conflict in extern C block

2018-05-01 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85601

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #1 from Andrew Pinski  ---
This was just fixed today: See bug 85580.

*** This bug has been marked as a duplicate of bug 85580 ***

[Bug c++/85601] New: [8 Regression] anonymous struct & union namespace conflict in extern C block

2018-05-01 Thread andres at anarazel dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85601

Bug ID: 85601
   Summary: [8 Regression] anonymous struct & union namespace
conflict in extern C block
   Product: gcc
   Version: 8.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: andres at anarazel dot de
  Target Milestone: ---

Hi,

When compiling with g++ anonymous structs / unions inside C functions conflict
based on their variable name.  That wasn't previously the case and doesn't seem
to make much sense.

Ex.:

extern "C"
{
  static inline void funca(void)
  {
  union
  {
int a;
  } myunion;

  (void) myunion;
  }

  static inline void funcb(void)
  {
  union
  {
int a;
  } myunion;

  (void) myunion;
  }
}

andres@alap4:~/src/postgresql$ /usr/lib/gcc-snapshot/bin/g++ --version
g++ (Debian 20180425-1) 9.0.0 20180425 (experimental) [trunk revision 259645]
..

andres@alap4:~/src/postgresql$ /usr/lib/gcc-snapshot/bin/g++ -c -o /tmp/frak.o
/tmp/frak.cc
/tmp/frak.cc: In function 'void funcb()':
/tmp/frak.cc:18:9: warning: conflicting C language linkage declaration
'funcb():: myunion'
   } myunion;
 ^~~
/tmp/frak.cc:8:9: note: previous declaration 'funca():: myunion'
   } myunion;
 ^~~
If I rename one of the *variables* in the *independent* functions the error
vanishes.

This currently triggers inside PostgreSQL's master branch (which now uses C++
for an optional module).

Regards,

Andres Freund

[Bug libstdc++/84654] libstdc++ tries to use __float128 when compiling with -mno-float128

2018-05-01 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84654

--- Comment #3 from Jonathan Wakely  ---
Author: redi
Date: Tue May  1 22:47:33 2018
New Revision: 259813

URL: https://gcc.gnu.org/viewcvs?rev=259813=gcc=rev
Log:
PR libstdc++/84654 Disable __float128 specializations for -mno-float128

2018-05-01  Tulio Magno Quites Machado Filho  

PR libstdc++/84654
* acinclude.m4: Set ENABLE_FLOAT128 instead of _GLIBCXX_USE_FLOAT128.
* config.h.in: Remove references to _GLIBCXX_USE_FLOAT128.
* configure: Regenerate.
* include/Makefile.am: Replace the value of _GLIBCXX_USE_FLOAT128
based on ENABLE_FLOAT128.
* include/Makefile.in: Regenerate.
* include/bits/c++config: Define _GLIBCXX_USE_FLOAT128.
[!defined(__FLOAT128__) && !defined(__SIZEOF_FLOAT128__)]: Undefine
_GLIBCXX_USE_FLOAT128.

Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/acinclude.m4
trunk/libstdc++-v3/config.h.in
trunk/libstdc++-v3/configure
trunk/libstdc++-v3/include/Makefile.am
trunk/libstdc++-v3/include/Makefile.in
trunk/libstdc++-v3/include/bits/c++config

[Bug tree-optimization/85143] Loop limit prevents (auto)vectorization

2018-05-01 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85143

--- Comment #7 from Marc Glisse  ---
Note that the patch still doesn't handle

  _1 = n_15(D) <= i_46;
  _2 = i_46 > 1336;
  _3 = _1 | _2;

because of the mix between strict and large inequalities.

(if I write int m = 1337; and replace i < 1337 with i < m, the transformation
does happen, and with a suitable -march it vectorizes)

[Bug lto/85574] [9 Regression] LTO bootstapped binaries differ

2018-05-01 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85574

Jan Hubicka  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-05-01
 Ever confirmed|0   |1

--- Comment #3 from Jan Hubicka  ---
I've tried bootstrap with -flto-partition=none and also get differences in
gengtype and cc1, so it seems to be unrealated to partitioning change.  First
bigger one is:

@@ -2875,506 +2875,507 @@
   40444b:  48 89 05 6e 64 02 00mov%rax,0x2646e(%rip)#
42a8c0 
   404452:  31 ff   xor%edi,%edi
   404454:  44 39 2d 15 65 02 00cmp%r13d,0x26515(%rip)#
42a970 
-  40445b:  7e 49   jle4044a6 
+  40445b:  7e 4e   jle4044ab 
   40445d:  e8 de 37 01 00  callq  417c40 <_ZL16peek_state_tokeni>
   404462:  bf 01 00 00 00  mov$0x1,%edi
-  404467:  49 89 c6mov%rax,%r14
-  40446a:  e8 d1 37 01 00  callq  417c40 <_ZL16peek_state_tokeni>
-  40446f:  bf 02 00 00 00  mov$0x2,%edi
-  404474:  48 89 c5mov%rax,%rbp
-  404477:  e8 c4 37 01 00  callq  417c40 <_ZL16peek_state_tokeni>



+  404467:  49 89 c7mov%rax,%r15
+  40446a:  48 89 04 24 mov%rax,(%rsp)
+  40446e:  e8 cd 37 01 00  callq  417c40 <_ZL16peek_state_tokeni>
+  404473:  bf 02 00 00 00  mov$0x2,%edi
+  404478:  48 89 c5mov%rax,%rbp
+  40447b:  e8 c0 37 01 00  callq  417c40 <_ZL16peek_state_tokeni>

So it seems to be something else than partitioning changes.  Looking at
assembly there are some things that seems like partitioning
differences. This partiuclar one doesn't seem to be.

[Bug tree-optimization/85143] Loop limit prevents (auto)vectorization

2018-05-01 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85143

--- Comment #6 from Marc Glisse  ---
Author: glisse
Date: Tue May  1 21:41:05 2018
New Revision: 259812

URL: https://gcc.gnu.org/viewcvs?rev=259812=gcc=rev
Log:
Generalize a

PR tree-optimization/85143
gcc/
* match.pd (A

[Bug c++/85600] CPU2006 471.omnetpp fails starting with r259771

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85600

--- Comment #2 from Pat Haugen  ---
(In reply to Andrew Pinski from comment #1)
> Does adding -fno-lifetime-dse help?  This could be a bug in the omnetpp
> sources ...

Nope, still fails.

471.omnetpp: copy 0 non-zero return code (exit code=1, signal=0)

[Bug c++/85600] CPU2006 471.omnetpp fails starting with r259771

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85600

--- Comment #1 from Andrew Pinski  ---
Does adding -fno-lifetime-dse help?  This could be a bug in the omnetpp sources
...

[Bug c++/85600] New: CPU2006 471.omnetpp fails starting with r259771

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85600

Bug ID: 85600
   Summary: CPU2006 471.omnetpp fails starting with r259771
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pthaugen at gcc dot gnu.org
  Target Milestone: ---

Benchmark is failing at runtime, emitting following message at the end before
exiting with rc=1.

** Event #0   T=0.000  ( 0.00s)
 Messages:  created: 77472
** Event #500   T=0.0868274600 ( 86ms)
 Messages:  created: 3949482
** Event #1000   T=0.1605411650 (160ms)
 Messages:  created: 7854099
 Error in module largeNet.llanBB[48].bhost[3].mac:
(cQueue)largeNet.llanBB[48].bhost[3].mac.class-members.outputBuffer: pop():
queue empty.

End run of OMNeT++

[Bug c++/81420] When a reference is bound to a member in the base of a temporary, lifetime of the temporary is not extended

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81420

--- Comment #3 from Marc Glisse  ---
Created attachment 44050
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44050=edit
untested hackish patch

This seems to help a bit, but it doesn't feel like the right approach.

[Bug fortran/85599] invalid optimization: function not always evaluated in logical expression

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85599

janus at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||wrong-code
   Target Milestone|--- |9.0

[Bug tree-optimization/85597] [6/7/8/9 Regression] internal compiler error: in compute_live_loop_exits, at tree-ssa-loop-manip.c:229

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85597

Marek Polacek  changed:

   What|Removed |Added

   Target Milestone|--- |6.5
Summary|internal compiler error: in |[6/7/8/9 Regression]
   |compute_live_loop_exits, at |internal compiler error: in
   |tree-ssa-loop-manip.c:229   |compute_live_loop_exits, at
   ||tree-ssa-loop-manip.c:229

[Bug libgomp/83792] [openacc] Factor out async argument utility functions

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83792

--- Comment #2 from Tom de Vries  ---
pinged: https://gcc.gnu.org/ml/gcc-patches/2018-05/msg00046.html

[Bug fortran/85599] New: invalid optimization: function not always evaluated in logical expression

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85599

Bug ID: 85599
   Summary: invalid optimization: function not always evaluated in
logical expression
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: janus at gcc dot gnu.org
  Target Milestone: ---

Consider the following test case:


program lazy

   logical :: flag

   flag = .false.
   flag = check() .and. flag  ! 'check' is executed as expected
   flag = flag .and. check()  ! bug: 'check' is not executed

contains

   logical function check()
  integer, save :: i = 1
  print *, "check", i
  i = i + 1
  check = .true.
   end function

end


The problem here is that gfortran executes the function 'check' only once,
although it should be executed twice AFAICS.

Optimizing out the function call might be valid for a PURE function, but for an
impure one with side effects, I don't think this is allowed.

Both ifort and flang execute the function twice. For gfortran, the optimization
level does not seem to influence the result: -O0 and -O3 behave in the same
way.

I tried with gfortran versions 5, 6, 7 and 8, which all exhibit the same buggy
behavior.

[Bug c/85598] New: Incorrect warning only at -O2 and -O3

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85598

Bug ID: 85598
   Summary: Incorrect warning only at -O2 and -O3
   Product: gcc
   Version: 7.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: thomas.mercier.jr at gmail dot com
  Target Milestone: ---

Created attachment 44049
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44049=edit
Preprocessed file of program that reproduces the behavior

$ gcc -v
Using built-in specs.
COLLECT_GCC=x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/brazil-pkg-cache/packages/GCC/GCC-7.x.200154.0/AL2012/DEV.STD.PTHREAD/build/gcc-7.3.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/local/p4clients/pkgbuild-Kfsa6/workspace/src/GCC/build/private/src/gcc-7.3.0/configure
--prefix=/local/p4clients/pkgbuild-Kfsa6/workspace/src/GCC/build/gcc-7.3.0
--enable-languages=c,c++,fortran --disable-plugin
--with-build-config=bootstrap-lto
--with-gmp=/local/p4clients/pkgbuild-Kfsa6/workspace/src/GCC/build/private/stage2
--with-mpfr=/local/p4clients/pkgbuild-Kfsa6/workspace/src/GCC/build/private/stage2
--with-mpc=/local/p4clients/pkgbuild-Kfsa6/workspace/src/GCC/build/private/stage2
--with-fpmath=sse --with-cpu-64=core2 --disable-multilib --disable-bootstrap
--with-glibc-version=2.12
--with-cloog=/local/p4clients/pkgbuild-Kfsa6/workspace/src/GCC/build/private/stage2
--with-ppl=/local/p4clients/pkgbuild-Kfsa6/workspace/src/GCC/build/private/stage2
--with-isl=/local/p4clients/pkgbuild-Kfsa6/workspace/src/GCC/build/private/stage2
--enable-libsanitizer --disable-stage1-checking
Thread model: posix
gcc version 7.3.0 (GCC) 


When compiled with -O2 or -O3 optimization enabled, the following warning is
printed:

$ gcc -Wall -O2 /tmp/test.c
/tmp/test.c: In function ‘main’:
/tmp/test.c:9:31: warning: ‘snprintf’ output may be truncated before the last
format character [-Wformat-truncation=]
   snprintf(str, 4, "%%%02X", x);
   ^
/tmp/test.c:9:7: note: ‘snprintf’ output between 4 and 5 bytes into a
destination of size 4
   snprintf(str, 4, "%%%02X", x);

   ^


With lesser levels of optimization, no warning is printed:
$ gcc -Wall -O1 /tmp/test.c
$


This is the entire program (preprocessed attached):

#include 

int main()
{
char temp[100];
unsigned int x;
char *str = temp;
for(x=0; x<256; ++x) {
  snprintf(str, 4, "%%%02X", x);
}
}

Calling snprintf with NULL and 0 for the first two arguments returns 3 for all
values of the loop. I believe the correct behavior from GCC is no warning at
any optimization level.

[Bug tree-optimization/85597] internal compiler error: in compute_live_loop_exits, at tree-ssa-loop-manip.c:229

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85597

Marek Polacek  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code

--- Comment #1 from Marek Polacek  ---
Started with r250811.

[Bug tree-optimization/85597] New: internal compiler error: in compute_live_loop_exits, at tree-ssa-loop-manip.c:229

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85597

Bug ID: 85597
   Summary: internal compiler error: in compute_live_loop_exits,
at tree-ssa-loop-manip.c:229
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

Target: x86_64-pc-linux-gnu
gcc version 9.0.0 20180501 (experimental) (GCC)

$ cat q.c
extern double fma (double, double, double);

static inline void
bar (int i, double *D, double *S)
{
  while (i-- > 0)
{
  D[0] = fma (1, S[0], D[0]);
  D[1] = fma (1, S[1], D[1]);
  D[2] = fma (1, S[2], D[2]);
  D[3] = fma (1, S[3], D[3]);
  D += 4;
  S += 4;
}
}

void
foo (double *d, double *s)
{
  bar (10, d, s);
}

$ ./cc1 -quiet q.c -O3 -mfma
during GIMPLE pass: vect
q.c: In function ‘foo’:
q.c:18:1: internal compiler error: in compute_live_loop_exits, at
tree-ssa-loop-manip.c:229
 foo (double *d, double *s)
 ^~~
0x11872fa compute_live_loop_exits
/home/mpolacek/src/gcc/gcc/tree-ssa-loop-manip.c:229
0x1187708 add_exit_phis_var
/home/mpolacek/src/gcc/gcc/tree-ssa-loop-manip.c:316
0x1187826 add_exit_phis
/home/mpolacek/src/gcc/gcc/tree-ssa-loop-manip.c:338
0x1188327 rewrite_into_loop_closed_ssa_1(bitmap_head*, unsigned int, int,
loop*)
/home/mpolacek/src/gcc/gcc/tree-ssa-loop-manip.c:660
0x1188380 rewrite_into_loop_closed_ssa(bitmap_head*, unsigned int)
/home/mpolacek/src/gcc/gcc/tree-ssa-loop-manip.c:681
0x13003b0 vectorize_loops()
/home/mpolacek/src/gcc/gcc/tree-vectorizer.c:853
0x11a70b1 execute
/home/mpolacek/src/gcc/gcc/tree-ssa-loop.c:414
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug libstdc++/85472] Regex match bug

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85472

--- Comment #21 from Hans Åberg  ---
(In reply to Tim Shen from comment #20)
> (In reply to Hans Åberg from comment #18)
> > (In reply to Tim Shen from comment #14)
> > > I have a C++ test case for this:
> > 
> > I get segmentation fault on the regex_match line with g++ 7.3.0.
> 
> On Linux I set "ulimit -s unlimited".

On MacOS, I can change the value, default 8192, but not to unlimited.

> The stack overflow is a known issue
> because the implementation is recursive.

I have a loop, as in Flex and Bison generated parsers.

[Bug c++/81420] When a reference is bound to a member in the base of a temporary, lifetime of the temporary is not extended

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81420

Marc Glisse  changed:

   What|Removed |Added

   Last reconfirmed|2018-01-08 00:00:00 |2018-5-1

--- Comment #2 from Marc Glisse  ---
Yes, this lifetime extension mechanism seems super fragile in gcc. Binding to a
base fails, binding to an array element fails

int d;

struct A
{
  int i[2];
  ~A() { ++d; };
};

int main()
{
  // int& = A().i[0];
  const int  = A().i[0];
  if (d != 0)
__builtin_abort();
}

even a regular member fails if referenced with a slightly different syntax (bug
53288).

[Bug target/85595] __atomic_is_lock_free(sizeof(unsigned long long), ) returns true on i686

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85595

--- Comment #2 from Jonathan Wakely  ---
(In reply to Alexander Ivchenko from comment #0)
> (long long is only 4-byte aligned on i686)

Not when it's placed on the stack. GCC will always align the variable in your
example to 8 bytes. But a better example shows that __atomic_is_lock_free does
still return true for objects aligned to 4 bytes.

[Bug target/85596] New: aarch64 --with-multilib-list documentation missing

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85596

Bug ID: 85596
   Summary: aarch64 --with-multilib-list documentation missing
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: wilson at gcc dot gnu.org
  Target Milestone: ---

config.gcc has aarch64 support for the --with-multilib-list option, but it
isn't documented in the doc/install.texi file.

[Bug lto/85451] [offloading] Improve lto-wrapper error message when not finding mkoffload

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85451

Tom de Vries  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #5 from Tom de Vries  ---
https://gcc.gnu.org/ml/gcc-patches/2018-05/msg00044.html

[Bug libstdc++/85472] Regex match bug

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85472

--- Comment #20 from Tim Shen  ---
(In reply to Hans Åberg from comment #18)
> (In reply to Tim Shen from comment #14)
> > I have a C++ test case for this:
> 
> I get segmentation fault on the regex_match line with g++ 7.3.0.

On Linux I set "ulimit -s unlimited". The stack overflow is a known issue
because the implementation is recursive.

[Bug target/85595] __atomic_is_lock_free(sizeof(unsigned long long), ) returns true on i686

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85595

--- Comment #1 from Andrew Pinski  ---
That does not mean the local variable is not aligned to 8 bytes ...

[Bug libstdc++/85472] Regex match bug

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85472

--- Comment #19 from Hans Åberg  ---
(In reply to Tim Shen from comment #16)
> I set (kStart, kEnd) to be (1000, 2000), (1000, 3000), ..., (1000, 9000) to
> see how the time grows. ...

> Here are my numbers for end ranging 2000 to 9000, in ms:
> [79,150,262,427,620,868,1078,1310].

I get segmentation fault beyond 4000, but for this value, it takes 1.130 s, so
your computer is about 4 times faster it seems.

[Bug target/85595] New: __atomic_is_lock_free(sizeof(unsigned long long), ) returns true on i686

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85595

Bug ID: 85595
   Summary: __atomic_is_lock_free(sizeof(unsigned long long), )
returns true on i686
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: aivchenk at gmail dot com
  Target Milestone: ---

in gcc __atomic_is_lock_free(sizeof(unsigned long long), ) returns true (in
clang it is left as a call)

int main()
{
  unsigned long long v;
  if (__atomic_is_lock_free(sizeof(unsigned long long), ))
return 0;
  else
return 1;
}

> g++ -O2 -m32 -std=gnu++11  -fno-exceptions -fno-rtti


main:
.LFB0:
xorl%eax, %eax
ret

> clang++ -O2 -m32 -std=gnu++11  -fno-exceptions -fno-rtti


main:   # @main
.Lfunc_begin0:
# %bb.0:
subl$12, %esp
.Ltmp0:
subl$8, %esp
leal8(%esp), %eax
pushl   %eax
pushl   $8
calll   __atomic_is_lock_free
addl$16, %esp
xorl%ecx, %ecx
testl   %eax, %eax
sete%cl
.Ltmp1:
movl%ecx, %eax
addl$12, %esp
retl


__atomic_is_lock_free always should return false for misaligned pointers (long
long is only 4-byte aligned on i686)

More details can be found at the bug filed against llvm
https://bugs.llvm.org/show_bug.cgi?id=36860

[Bug libstdc++/85472] Regex match bug

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85472

--- Comment #18 from Hans Åberg  ---
(In reply to Tim Shen from comment #14)
> I have a C++ test case for this:

I get segmentation fault on the regex_match line with g++ 7.3.0.

[Bug lto/85451] [offloading] Improve lto-wrapper error message when not finding mkoffload

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85451

--- Comment #4 from Tom de Vries  ---
Author: vries
Date: Tue May  1 19:52:57 2018
New Revision: 259809

URL: https://gcc.gnu.org/viewcvs?rev=259809=gcc=rev
Log:
[nvptx] Improve "offload compiler not found" message in mkoffload

2018-05-01  Tom de Vries  

PR lto/85451
* config/nvptx/mkoffload.c (main): Suggest using -B in "offload
compiler
not found" error message.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/nvptx/mkoffload.c

[Bug libstdc++/85472] Regex match bug

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85472

--- Comment #17 from Hans Åberg  ---
(In reply to Tim Shen from comment #16)
> (In reply to Hans Åberg from comment #15)
> > (In reply to Tim Shen from comment #14)
> > > How fast does your prototype run on the following example?
> > >   ((10)|(11)|(12)|...|(98)|(99))* matching "10111213141516...9899"
> > > how about this:
> > >   ((100)|(101)|(102)|...|(998)|(999))* matching "100101102...998999"
> > > 
> > > where "..." are the skipped strings that follow the surrounding pattern.
> > 
> > My program does not choke on limit cases, like the regex '(a?)^k a^k' on the
> > string string "a"^k, mentioned at [1]; for k = 100, it takes 0.393 s on the
> > NFA and 0.168 on the DFA on a not so powerful computer. Otherwise, it is not
> > optimized and fast in absolute terms: I use standard C++ containers such as
> > unordered_set for DFA state lookups, and not a number.
> > 
> > 1. https://swtch.com/~rsc/regexp/regexp1.html
> 
> Sorry, I meant to observe whether the example triggers a O(k^2) behavior. It
> should be less than quadratic. To measure this, you don't have to compare
> the time of your prototype against libstdc++.

I'll have to get back on this. But it shouldn't choke:

During the lexing, I just record the DFA states as function of the string
positions. When a final state appears, the reverse NFA data can be used to
compute the NFA states this match actually uses, and therefore, as the
characters are known, also the NFA transitions, and any data that depends on
it.

[Bug rtl-optimization/85594] New: ICE during expand when compiling with -fwrapv -fopenmp

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85594

Bug ID: 85594
   Summary: ICE during expand when compiling with -fwrapv -fopenmp
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: kristerw at gcc dot gnu.org
  Target Milestone: ---

Compiling gcc/testsuite/gcc.dg/gomp/pr81768-2.c with "-fwrapv -fopenmp" fails
with an ICE:

> gcc -S -fwrapv -fopenmp pr81768-2.c 
during RTL pass: expand
../pr81768-2.c: In function 'foo._omp_fn.1':
../pr81768-2.c:10:9: internal compiler error: in make_decl_rtl, at
varasm.c:1322
 #pragma omp target parallel for schedule(static, 32) collapse(3)
 ^~~
0x5d230c make_decl_rtl(tree_node*)
../../gcc/gcc/varasm.c:1318
0x7c79bc expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../gcc/gcc/expr.c:9965
0x7d05de expand_expr
../../gcc/gcc/expr.h:280
0x7d05de expand_expr_addr_expr_1
../../gcc/gcc/expr.c:7946
0x7d0465 expand_expr_addr_expr_1
../../gcc/gcc/expr.c:7992
0x7c698d expand_expr_addr_expr
../../gcc/gcc/expr.c:8067
0x7c698d expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../gcc/gcc/expr.c:11239
0x7433a0 expand_normal
../../gcc/gcc/expr.h:286
0x7433a0 do_compare_and_jump
../../gcc/gcc/dojump.c:1196
0x744253 do_jump_1(tree_code, tree_node*, tree_node*, rtx_code_label*,
rtx_code_label*, profile_probability)
../../gcc/gcc/dojump.c:261
0x6dc3cc expand_gimple_cond
../../gcc/gcc/cfgexpand.c:2495
0x6dc3cc expand_gimple_basic_block
../../gcc/gcc/cfgexpand.c:5674
0x6dff66 execute
../../gcc/gcc/cfgexpand.c:6425
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug c++/85444] asm specifier on typedef silently ignored

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85444

--- Comment #10 from Will Hawkins  ---
Thanks for the feedback! I tried ignored-attributes but Mr. Meyers said that
was not an appropriate match. I think that I am going to have to go with adding
a completely separate category. This will be good practice for handling PR
44209. 

Thanks again for the feedback!

[Bug target/85593] GCC on ARM allocates R3 for local variable when calling naked function with O2 optimizations enabled

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85593

--- Comment #2 from Austin Morton  ---
Where is this limitation documented? The GCC documentation on the naked
function attribute makes no mention of such a caveat:
https://gcc.gnu.org/onlinedocs/gcc/ARM-Function-Attributes.html


See here for real world usage that triggers this issue:
https://git.kernel.org/pub/scm/bluetooth/sbc.git/tree/sbc/sbc_primitives_armv6.c

Note that I am not the original author of the above code, just someone who ran
into issues attempting to use it on gcc newer than 4.x

In this specific case it is simple enough to fix by pushing r3, but it seemed
like a bug with the compiler, considering the behavior changed between major
releases.

If this is indeed an issue with the code itself and not the compiler, that is
fine, but it should certainly be documented that naked functions are not meant
to be called directly.

[Bug other/83786] Add VEC_ORDERED_REMOVE_IF

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83786

Tom de Vries  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED
   Assignee|unassigned at gcc dot gnu.org  |vries at gcc dot gnu.org
   Target Milestone|--- |9.0

--- Comment #4 from Tom de Vries  ---
Patch committed, marking resolved-fixed.

[Bug other/83786] Add VEC_ORDERED_REMOVE_IF

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83786

--- Comment #3 from Tom de Vries  ---
Author: vries
Date: Tue May  1 19:16:43 2018
New Revision: 259808

URL: https://gcc.gnu.org/viewcvs?rev=259808=gcc=rev
Log:
Add VEC_ORDERED_REMOVE_IF

2018-05-01  Tom de Vries  

PR other/83786
* vec.h (VEC_ORDERED_REMOVE_IF, VEC_ORDERED_REMOVE_IF_FROM_TO): Define.
* vec.c (test_ordered_remove_if): New function.
(vec_c_tests): Call test_ordered_remove_if.
* dwarf2cfi.c (connect_traces): Use VEC_ORDERED_REMOVE_IF_FROM_TO.
* lto-streamer-out.c (prune_offload_funcs): Use VEC_ORDERED_REMOVE_IF.
* tree-vect-patterns.c (vect_pattern_recog_1): Use
VEC_ORDERED_REMOVE_IF.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/dwarf2cfi.c
trunk/gcc/lto-streamer-out.c
trunk/gcc/tree-vect-patterns.c
trunk/gcc/vec.c
trunk/gcc/vec.h

[Bug target/85593] GCC on ARM allocates R3 for local variable when calling naked function with O2 optimizations enabled

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85593

--- Comment #1 from Andrew Pinski  ---
I don't think naked function are supposed to be called directly.

[Bug libstdc++/85472] Regex match bug

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85472

--- Comment #16 from Tim Shen  ---
(In reply to Hans Åberg from comment #15)
> (In reply to Tim Shen from comment #14)
> > How fast does your prototype run on the following example?
> >   ((10)|(11)|(12)|...|(98)|(99))* matching "10111213141516...9899"
> > how about this:
> >   ((100)|(101)|(102)|...|(998)|(999))* matching "100101102...998999"
> > 
> > where "..." are the skipped strings that follow the surrounding pattern.
> 
> My program does not choke on limit cases, like the regex '(a?)^k a^k' on the
> string string "a"^k, mentioned at [1]; for k = 100, it takes 0.393 s on the
> NFA and 0.168 on the DFA on a not so powerful computer. Otherwise, it is not
> optimized and fast in absolute terms: I use standard C++ containers such as
> unordered_set for DFA state lookups, and not a number.
> 
> 1. https://swtch.com/~rsc/regexp/regexp1.html

Sorry, I meant to observe whether the example triggers a O(k^2) behavior. It
should be less than quadratic. To measure this, you don't have to compare the
time of your prototype against libstdc++.

I set (kStart, kEnd) to be (1000, 2000), (1000, 3000), ..., (1000, 9000) to see
how the time grows. I changed my pattern a bit to make it k lg k. I'm more
curious about the time complexity your program takes, as I was not able to
understand your algorithm description.

Here are my numbers for end ranging 2000 to 9000, in ms:
[79,150,262,427,620,868,1078,1310].

The difference array: [71, 112, 165, 193, 248, 210, 232].

I think it's vaguely k lg k, but I'm not quite sure yet.

Here is the updated example, to re-arrange the expression to a tree, not a
chain of "|" operators.

#include 
#include 
#include 
#include 
#include 

void gen_pattern(int start, int end, std::string& acc) {
  if (!(start < end)) {
std::abort();
  }
  if (start + 1 == end) {
acc += '(';
acc += std::to_string(start);
acc += ')';
return;
  }
  int mid = (start + end) / 2;
  if (start + 1 == mid) {
gen_pattern(start, mid, acc);
  } else {
acc += "(?:";
gen_pattern(start, mid, acc);
acc += ")";
  }

  acc += "|";

  if (mid + 1 == end) {
gen_pattern(mid, end, acc);
  } else {
acc += "(?:";
gen_pattern(mid, end, acc);
acc += ")";
  }
}

int main(int argc, char** argv) {
  if (argc < 3) {
std::abort();
  }
  int start = atoi(argv[1]);
  int end = atoi(argv[2]);

  std::regex re;
  {
std::string pattern;
gen_pattern(start, end, pattern);
re.assign("(" + pattern + ")*");
  }
  std::string s;
  for (int i = start; i < end; i++) {
s += std::to_string(i);
  }
  std::smatch m;
  std::cout << std::regex_match(s, m, re) << "\n";
  //for (const auto p : m) {
  //  std::cout << p << " ";
  //}
  //std::cout << "\n";
  return 0;
}

[Bug inline-asm/85593] New: GCC on ARM allocates R3 for local variable when calling naked function with O2 optimizations enabled

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85593

Bug ID: 85593
   Summary: GCC on ARM allocates R3 for local variable when
calling naked function with O2 optimizations enabled
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: inline-asm
  Assignee: unassigned at gcc dot gnu.org
  Reporter: austinpmorton at gmail dot com
  Target Milestone: ---

Created attachment 44048
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44048=edit
example code triggering bug

When calling a naked function declared in the same translation unit which
includes inline assembly that modifies registers which are not preserved across
function calls according to the arm abi (R0-R3), GCC 5+ can incorrectly
allocate these registers for local variables in the caller and expect them to
persist between function calls.

* -O2 must be enabled to observe this behavior.
* the function must be declared in the same translation unit, if declared
extern gcc correctly allocates preserved registers for its locals
* GCC 4.6.4 correctly allocates R4 in the example code given
* GCC 5.4, and all higher versions tested incorrectly allocates R3 in the
example code given
* I have built a clean copy of GCC trunk and observed this issue as well

note: this issue is present on all arm triplets I have tested, not just
arm-none-eabi.

compile bug.c with the following options to observe the bug
arm-none-eabi-gcc -O2 -DBUG -S bug.c -o -

compile bug.c with the following options to observe the correct behavior with
an extern declaration
arm-none-eabi-gcc -O2 -S bug.c -o -

note that in the non-working compiler versions gcc attempts to load a value
from r3 between calls to test2, whereas in the working compiler versions gcc
will produce identical code save for using r4.

for convenience sake, here is the example shown in working vs nonworking
compiler versions on godbolt:
https://godbolt.org/g/kMSn8W

[Bug c/84258] Bogus -Wformat warning "wide character string" for const unsigned char

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84258

David Malcolm  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from David Malcolm  ---
Fixed for gcc 9 by r259807.

[Bug c/84258] Bogus -Wformat warning "wide character string" for const unsigned char

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84258

--- Comment #5 from David Malcolm  ---
Author: dmalcolm
Date: Tue May  1 18:51:15 2018
New Revision: 259807

URL: https://gcc.gnu.org/viewcvs?rev=259807=gcc=rev
Log:
-Wformat: fix nonsensical "wide character" message (PR c/84258)

gcc/c-family/ChangeLog:
PR c/84258
* c-format.c (struct format_check_results): Add field
"number_non_char".
(check_format_info): Initialize it, and warn if encountered.
(check_format_arg): Distinguish between wide char and
everything else when detecting arrays of non-char.

gcc/testsuite/ChangeLog:
PR c/84258
* c-c++-common/Wformat-pr84258.c: New test.


Added:
trunk/gcc/testsuite/c-c++-common/Wformat-pr84258.c
Modified:
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-format.c
trunk/gcc/testsuite/ChangeLog

[Bug libstdc++/85472] Regex match bug

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85472

--- Comment #15 from Hans Åberg  ---
(In reply to Tim Shen from comment #14)
> How fast does your prototype run on the following example?
>   ((10)|(11)|(12)|...|(98)|(99))* matching "10111213141516...9899"
> how about this:
>   ((100)|(101)|(102)|...|(998)|(999))* matching "100101102...998999"
> 
> where "..." are the skipped strings that follow the surrounding pattern.

My program does not choke on limit cases, like the regex '(a?)^k a^k' on the
string string "a"^k, mentioned at [1]; for k = 100, it takes 0.393 s on the NFA
and 0.168 on the DFA on a not so powerful computer. Otherwise, it is not
optimized and fast in absolute terms: I use standard C++ containers such as
unordered_set for DFA state lookups, and not a number.

1. https://swtch.com/~rsc/regexp/regexp1.html

[Bug target/85592] __builtin_cpu_is and __builtin_cpu_supports should be supported for aarch64

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85592

Andrew Pinski  changed:

   What|Removed |Added

Summary|__builtin_cpu_is does not   |__builtin_cpu_is and
   |exist on aarch64|__builtin_cpu_supports
   ||should be supported for
   ||aarch64

--- Comment #1 from Andrew Pinski  ---
__builtin_cpu_supports should be supported also.

[Bug target/85592] __builtin_cpu_is does not exist on aarch64

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85592

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug target/85592] New: __builtin_cpu_is does not exist on aarch64

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85592

Bug ID: 85592
   Summary: __builtin_cpu_is does not exist on aarch64
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
Target: aarch64-*-*

__builtin_cpu_is should be supported for aarch64; just like PowerPC and x86.

[Bug c/85465] [og7, openacc] ICE in mark_vars_oacc_gangprivate, at c/c-parser.c:14213

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85465

Tom de Vries  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from Tom de Vries  ---
Patch with test-case committed, marking resolved-fixed.

[Bug c/85465] [og7, openacc] ICE in mark_vars_oacc_gangprivate, at c/c-parser.c:14213

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85465

--- Comment #1 from Tom de Vries  ---
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b5146f735883031f6661dda1d3ee9a34ad557e52

[c, openacc] Handle non-var-decl in mark_vars_oacc_gangprivate

2018-05-01  Tom de Vries  

PR target/85465
* c-parser.c (mark_vars_oacc_gangprivate): Skip BLOCK_VARS that are not
VAR_DECL.

* testsuite/libgomp.oacc-c/pr85465.c: New test.

[Bug libstdc++/80506] Wrong magic number in std::gamma_distribution

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80506

--- Comment #3 from emsr at gcc dot gnu.org ---
I'm now of the opinion that we should push these down.
At least gcc-7.
That's what I'm doing with the specfun bits.

[Bug tree-optimization/85588] [6/7/8/9 Regression] -fwrapv miscompilation

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85588

--- Comment #2 from Marek Polacek  ---
Started with r229484.

[Bug libstdc++/85472] Regex match bug

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85472

--- Comment #14 from Tim Shen  ---
How fast does your prototype run on the following example?
  ((10)|(11)|(12)|...|(98)|(99))* matching "10111213141516...9899"
how about this:
  ((100)|(101)|(102)|...|(998)|(999))* matching "100101102...998999"

where "..." are the skipped strings that follow the surrounding pattern.

For the record, for the 100-999 case, libstdc++ takes 0.112 seconds given a
proper stack limit. libc++ takes 6.386 seconds.

I have a C++ test case for this:

#include 
#include 
#include 

constexpr int kStart = 100;
constexpr int kEnd = 1000;

int main() {
  std::regex re;
  {
std::string re_string;
re_string += '(';
re_string += std::string("(") + std::to_string(kStart) + ")";
for (int i = kStart + 1; i < kEnd; i++) {
  re_string += '|';
  re_string += '(';
  re_string += std::to_string(i);
  re_string += ')';
}
re_string += ')';
re_string += '*';
re.assign(re_string);
  }
  std::string s;
  for (int i = kStart; i < kEnd; i++) {
s += std::to_string(i);
  }
  std::smatch m;
  std::cout << std::regex_match(s, m, re) << "\n";
  for (const auto p : m) {
std::cout << p << " ";
  }
  std::cout << "\n";
  return 0;
}

[Bug tree-optimization/82665] missing value range optimization for memchr

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82665

Jeffrey A. Law  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||law at redhat dot com
 Resolution|--- |FIXED

--- Comment #4 from Jeffrey A. Law  ---
Fixed on the trunk.

[Bug tree-optimization/82665] missing value range optimization for memchr

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82665

--- Comment #3 from Jeffrey A. Law  ---
Author: law
Date: Tue May  1 18:20:39 2018
New Revision: 259806

URL: https://gcc.gnu.org/viewcvs?rev=259806=gcc=rev
Log:
PR tree-optimization/82665
* vr-values.c (vr_values::extract_range_from_binary_expr): Handle
pointer subtraction where arguments come from a memchr call.

PR tree-optimization/82665
* gcc.dg/tree-ssa/pr82665.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr82665.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/vr-values.c

[Bug c++/85587] [8/9 Regression] bogus error: ‘F’ was not declared in this scope

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85587

--- Comment #1 from Jason Merrill  ---
Author: jason
Date: Tue May  1 18:11:53 2018
New Revision: 259805

URL: https://gcc.gnu.org/viewcvs?rev=259805=gcc=rev
Log:
PR c++/85587 - error with scoped enum in template.

* semantics.c (finish_qualified_id_expr): Don't return an
unqualified IDENTIFIER_NODE.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/scoped_enum8.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/semantics.c

[Bug libgcc/85591] New: __builtin_cpu_is() is not detecting bdver2 with Model = 0x02

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85591

Bug ID: 85591
   Summary: __builtin_cpu_is() is not detecting bdver2 with Model
= 0x02
   Product: gcc
   Version: 8.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libgcc
  Assignee: unassigned at gcc dot gnu.org
  Reporter: lebedev.ri at gmail dot com
  Target Milestone: ---

$ lscpu 
Architecture:x86_64
CPU op-mode(s):  32-bit, 64-bit
Byte Order:  Little Endian
CPU(s):  8
On-line CPU(s) list: 0-7
Thread(s) per core:  2
Core(s) per socket:  4
Socket(s):   1
NUMA node(s):1
Vendor ID:   AuthenticAMD
CPU family:  21
Model:   2
Model name:  AMD FX(tm)-8350 Eight-Core Processor
Stepping:0
CPU MHz: 3787.386
CPU max MHz: 4000.
CPU min MHz: 1400.
BogoMIPS:8027.22
Virtualization:  AMD-V
L1d cache:   16K
L1i cache:   64K
L2 cache:2048K
L3 cache:8192K
NUMA node0 CPU(s):   0-7
Flags:   fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb
rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf
pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt aes xsave avx f16c
lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch
osvw ibs xop skinit wdt lwp fma4 tce nodeid_msr tbm topoext perfctr_core
perfctr_nb cpb hw_pstate vmmcall bmi1 arat npt lbrv svm_lock nrip_save
tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold
$ cat /tmp/test.cpp 
#include 

int main (int argc, char* argv[]) {
  std::cout << __builtin_cpu_is("bdver2") << " " << __builtin_cpu_is("bdver1")
<< "\n";
return 0;
}
$ g++-8 /tmp/test.cpp 
$ ./a.out 
0 1
$ echo | gcc-8 -E - -march=native -### 
Using built-in specs.
COLLECT_GCC=gcc-8
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 8-20180425-1'
--with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --with-as=/usr/bin/x86_64-linux-gnu-as
--with-ld=/usr/bin/x86_64-linux-gnu-ld --program-suffix=-8
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie
--with-system-zlib --with-target-system-zlib --enable-objc-gc=auto
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 8.0.1 20180425 (experimental) [trunk revision 259628] (Debian
8-20180425-1) 
COLLECT_GCC_OPTIONS='-E' '-march=native'
 /usr/lib/gcc/x86_64-linux-gnu/8/cc1 -E -quiet -imultiarch x86_64-linux-gnu -
"-march=bdver2" -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16
-msahf -mno-movbe -maes -mno-sha -mpclmul -mpopcnt -mabm -mlwp -mfma -mfma4
-mxop -mbmi -mno-sgx -mno-bmi2 -mno-pconfig -mno-wbnoinvd -mtbm -mavx -mno-avx2
-msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mno-rdrnd -mf16c -mno-fsgsbase
-mno-rdseed -mprfchw -mno-adx -mfxsr -mxsave -mno-xsaveopt -mno-avx512f
-mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt
-mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl
-mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb
-mno-mwaitx -mno-clzero -mno-pku -mno-rdpid -mno-gfni -mno-shstk
-mno-avx512vbmi2 -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg
-mno-movdiri -mno-movdir64b --param "l1-cache-size=16" --param
"l1-cache-line-size=64" --param "l2-cache-size=2048" "-mtune=bdver2"
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-E' '-march=native'


So the `-march=native` detects it properly, but not the builtins.

The LLVM/clang side with patches is on https://reviews.llvm.org/D46314

[Bug c/65892] gcc fails to implement N685 aliasing of union members

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65892

--- Comment #61 from Davin McCall  ---
(In reply to James Kuyper Jr. from comment #59)
> (In reply to Davin McCall from comment #56)
> > (In reply to James Kuyper Jr. from comment #55)
> > > The problem is, you're using a statement that the access must occur via a
> > > union, with the implication that the code in question does not access the
> > > member through the union.
> > 
> > If "via a union" allows that at some point that the address of a union
> > member was taken and that pointer is then dereferenced, and type punning via
> > a union is allowed (as is implied by another footnote in the same section),
> > then:
> 
> Footnote 95 is the only one I can find which allows type punning via a union
> - is that the one you're referring to? Footnote 95 makes absolutely no use
> of the word "via". It says, quite explicitly, "the member used to read the
> contents of a union", and therefore can't apply when not directly using an
> actual member to read it.

Since footnote 95 is a footnote, and therefore non-normative, so actual text
that would limit type punning to only direct union member access would have to
appear in the normative text, but doesn't. In an expression "u.a" where u is a
union object, the result "is an lvalue if" (u) "is an lvalue" (assume for this
example that it is) and also the value is "that of the named member" (a). To
apply the "&" operator to that (as in ""), then "the result is a pointer to
the object or function designated by its operand". When I then de-reference
that pointer, "the result is an lvalue designating the object", exactly as the
result of the member access operator. When the lvalue is used as per 6.3.2.1 it
is "converted to the value stored in the designated object" which, if it is
referring to a member object, seems to me to be the same as saying that it is
converted to the value "of the named member", as with direct member access.

Since the rest of my points hinged on the idea that is inconsistent to believe
that the clause regarding the common initial sequence applies universally while
type punning requires direct/immediate use of the union, and you disagree with
that tenet, then I don't see a need to go through the other points one by one
and I will let the matter rest unless you would like to discuss it privately
via email (to avoid making even more noise here).

[Bug c/65892] gcc fails to implement N685 aliasing of union members

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65892

--- Comment #60 from Andrew Haley  ---
(In reply to James Kuyper Jr. from comment #51)
> (In reply to Andrew Haley from comment #49)
> > (In reply to James Kuyper Jr. from comment #46)
> > 
> > The principle of type-based alias analysis is that all you know about
> > two types is their types, not the location of any code that uses them.
> > There are no scopes.  The oracle, given only the types, has to say
> > whether they alias or not, regardless of where those types are used in
> > a program.  The location isn't an input to the oracle.
> > 
> > Bear in mind that inlining and other kinds of code motion happen, and
> > code is often evaluated "outside" the scopes in which it was written
> > and in a completely different order.  That's all perfectly normal
> > optimization.
> > 
> > Besides, when the alias oracle is consulted, all that scope stuff has
> > gone.  It's only relevant to the front end.
> 
> I was only pointing out that implementing this special guarantee where it
> applies, and only where it applies, requires keeping information that must
> already have been collected. If the current design discards that information
> before performing the relevant optimizations, I can understand that this
> would require a significant re-design - but the re-design takes the form of
> saving information already collected, not of collecting additional
> information.

Well, yes, but this is all stuff we already know.  A total redesign of
alias analysis is not going to happen just for this rule.

> > > > So, if any union types with a common initial sequence are declared
> > > > anywhere in a program, then their member types alias.
> > > 
> > > As I understand it, the visibility rule was added specifically for
> > > the purpose of NOT requiring that the entire program be covered by
> > > this exception.
> > 
> > I don't think so.  As I read it, it was a way of declaring to the
> > compiler that they types are intended to alias.
>
> By "the visibility rule", I mean, very specifically, the phrase
> "anywhere that a declaration of the completed type of the union is
> visible". If the intent had been to disable aliasing throughout the
> entire program, that intent could have been expressed by simply
> removing those words entirely; if there was any doubt that people
> would understand the absence of those words correctly, then they
> could have been replaced with the phrase "anywhere, regardless of
> whether or not the completed type of the union was visible". I don't
> see any plausible reason for the committee to write "anywhere that a
> declaration of the completed type of the union is visible", unless
> that phrase was intended to restrict applicability of the special
> guarantee.

And in 1990s compiler technology it might well have been possible to
restrict the effect of this to a single function.  Back then it was
commonplace to parse a function, generate code, and then throw
everything except the code away.  But compiler technology has moved a
long way since then and it is inevitable that if we are to honour N685
we must coarsen the effect of the visibility of the union.

> > > Knowledgeable people writing code intended to take advantage of this
> > > feature of C are likely to carefully place completed declarations of
> > > the union's type so they disable those optimizations only where they
> > > need to be disabled, and to minimize the amount of code where this
> > > exception would unnecessarily disable useful optimizations.
> > 
> > Perhaps so, yes, but in practice it'd be pretty hard to do that.
> > Functions can only be defined in the other scope, and there's no way
> > to undefine a union type. 
> 
> True, but failing to define the union type is quite trivial. If I were
> writing code that used both struct types, but not the union type, and did
> nothing that relied upon the fact that they can alias each other, I would
> simply not #include the header that defines the completed union type,
> #including only the header that defines the struct types.

That'll be fine if you're only compiling a single translation unit at
a time.  If you're using link-time optimization, however, then the
effect of declaring structs in a union will inevitably result in those
structs being treated as aliases for the entire program being linked,
for the simple reason that the alias oracle always returns the same
answer when asked if two types are are aliases.  Therefore, if they're
aliases anywhere they must be aliases everywhere.

[Bug libstdc++/83140] assoc_legendre returns negated value when m is odd

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83140

--- Comment #1 from emsr at gcc dot gnu.org ---
Created attachment 44047
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44047=edit
This adds a defaulted arg to the underlying __assoc_legendre_p for phase.


2018-05-02  Edward Smith-Rowland  <3dw...@verizon.net>

PR libstdc++83140 - assoc_legendre returns negated value when m is odd
* include/tr1/legendre_function.tcc (__assoc_legendre_p): Add __phase
argument defaulted to +1.  Doxy comments on same.
* testsuite/special_functions/02_assoc_legendre/
check_assoc_legendre.cc: Regenerate.
* testsuite/tr1/5_numerical_facilities/special_functions/
02_assoc_legendre/check_tr1_assoc_legendre.cc: Regenerate.
* testsuite/special_functions/02_assoc_legendre/pr83140.cc: New.
* testsuite/tr1/5_numerical_facilities/special_functions/
02_assoc_legendre/pr83140.cc: New.

[Bug c++/85587] [8/9 Regression] bogus error: ‘F’ was not declared in this scope

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85587

Jason Merrill  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-05-01
   Assignee|unassigned at gcc dot gnu.org  |jason at gcc dot gnu.org
 Ever confirmed|0   |1

[Bug c++/85444] asm specifier on typedef silently ignored

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85444

--- Comment #9 from Jonathan Wakely  ---
I don't see an appropriate one, so I'd add a new one.

Maybe the closest is something like -Wignored-attributes but that's not quite
right.

[Bug c++/83258] Rejecting function pointer non-type template parameter without linkage

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83258

--- Comment #4 from Jonathan Wakely  ---
Testcase from Bug 85589:

template struct foo {};

int main() {
static auto v = "str";
(void) foo {};
}

[Bug target/81805] Another libgomp.c/for-5.c failure on nvptx -- illegal memory access

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81805

Tom de Vries  changed:

   What|Removed |Added

 Target||nvptx
 Status|NEW |RESOLVED
  Component|testsuite   |target
 Resolution|--- |WORKSFORME

--- Comment #13 from Tom de Vries  ---
This test-case is passing with the latest nvidia driver (390.48). Marking
resolved-worksforme.

[Bug c++/85589] Non type template parameter should allow object with no linkage

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85589

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #1 from Jonathan Wakely  ---
I think this is a dup of PR 83258 so I'll add this testcase there.

*** This bug has been marked as a duplicate of bug 83258 ***

[Bug c++/83258] Rejecting function pointer non-type template parameter without linkage

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83258

Jonathan Wakely  changed:

   What|Removed |Added

 CC||gufideg at gmail dot com

--- Comment #3 from Jonathan Wakely  ---
*** Bug 85589 has been marked as a duplicate of this bug. ***

[Bug c++/85444] asm specifier on typedef silently ignored

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85444

--- Comment #8 from Will Hawkins  ---
Help!

Just wanted to let everyone know that I submitted a patch for this to
gcc-patches and got feedback. However, I need some help!

There's no consensus on the category that should contain this warning. I have
tried two, but neither passed muster from senior developers.

Can anyone suggest a warning category that could be applicable? Thanks!!

[Bug libstdc++/85472] Regex match bug

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85472

--- Comment #13 from Hans Åberg  ---
(In reply to Tim Shen from comment #11)
> If you think it's time and space efficiently doable, maybe you can develop a
> prototype first.

I put action number lists on the NFA transitions (no markup of the states). But
then the things I described before work.

Theoretically it may be simplest to start with a NFA with empty (ε)
transitions: For the sub-automatons one is interested in to find matches for,
put a unique action number on the start and final state transitions, marked
begin resp. end match. When compacted to a NFA without empty transitions, which
is what I use, they become lists.

I use bra-ket notation  to indicate the action number k begin-end match
of the automaton A; parentheses indicate grouping. Then the original example
can be written
  <1|z|1>(<2|<3|a*|3><4|b*|4><5|c|5>|2>)*

My program then produces the following result, first the NFA, and then the
matches:

ex = (ε ↦ {<1|0}, {
  0: {z ↦ {|1><2|<3||3><4||4><5|3, |1><2|<3||3><4|2, |1><2|<3|1, |1>∅}}
  1: {a ↦ {1, |3><4|2, |3><4||4><5|3}}
  2: {b ↦ {2, |4><5|3}}
  3: {c ↦ {|5>|2><2|<3||3><4||4><5|3, |5>|2><2|<3||3><4|2, |5>|2><2|<3|1,
|5>|2>∅}}}, {})

> zaacbbbcac
Full string is a valid match!
Matches: {zaacbbbcac, [@1@4@8@10];
<1|z|1>
<1|z|1> <2|<3|aa|3><4||4><5|c|5>|2>
<1|z|1> <2|<3|aa|3><4||4><5|c|5>|2> <2|<3||3><4|bbb|4><5|c|5>|2>
<1|z|1> <2|<3|aa|3><4||4><5|c|5>|2> <2|<3||3><4|bbb|4><5|c|5>|2>
<2|<3|a|3><4||4><5|c|5>|2>
}

In the first NFA description, transition actions are written after the action
that one pass over. So, for example, the original start state ε ↦ {<1|0} means
that one opens the match <1| to arrive at state 1; then all possibilities in
state 1 closes it with |1>, then opening some other matches.

In the matches description, after the matched string follows, the final state
match string lengths follows, so that eventual empty matches get number 0. The
longest match last then have at the end the sequence
  <2|<3|a|3><4||4><5|c|5>|2>
which is what is asked for: #2 "ac, #3 "a", #4 "", #5 "c", in addition to # 1
"z" first.

[Bug c++/85279] [6 Regression] Broken diagnostic for decltype

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85279

Jason Merrill  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|6.5 |7.4

--- Comment #3 from Jason Merrill  ---
Fixed for 7.4.

[Bug libgomp/84871] libgomp examples-4/declare_target-[12].f90 fail with nvptx Titan V offloading

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84871

Tom de Vries  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||vries at gcc dot gnu.org
 Resolution|--- |DUPLICATE

--- Comment #1 from Tom de Vries  ---
Duplicate of PR85519.

*** This bug has been marked as a duplicate of bug 85519 ***

[Bug target/85519] [nvptx, openacc, openmp, testsuite] Recursive tests may fail due to thread stack limit

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85519

Tom de Vries  changed:

   What|Removed |Added

 CC||cesar at gcc dot gnu.org

--- Comment #5 from Tom de Vries  ---
*** Bug 84871 has been marked as a duplicate of this bug. ***

[Bug target/85590] New: [nvptx, libgomp, openacc] Use cuda runtime fns to determine launch configuration in nvptx plugin

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85590

Bug ID: 85590
   Summary: [nvptx, libgomp, openacc] Use cuda runtime fns to
determine launch configuration in nvptx plugin
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: enhancement
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Choosing runtime dimensions is done in nvptx_exec for openacc.

We could use cuda runtime functions to assist us choosing runtime dimensions,
as indicated in
https://devblogs.nvidia.com/cuda-pro-tip-occupancy-api-simplifies-launch-configuration/
.

[Bug c/65892] gcc fails to implement N685 aliasing of union members

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65892

--- Comment #59 from James Kuyper Jr.  
---
(In reply to Davin McCall from comment #56)
> (In reply to James Kuyper Jr. from comment #55)
> > The problem is, you're using a statement that the access must occur via a
> > union, with the implication that the code in question does not access the
> > member through the union.
> 
> If "via a union" allows that at some point that the address of a union
> member was taken and that pointer is then dereferenced, and type punning via
> a union is allowed (as is implied by another footnote in the same section),
> then:

Footnote 95 is the only one I can find which allows type punning via a union -
is that the one you're referring to? Footnote 95 makes absolutely no use of the
word "via". It says, quite explicitly, "the member used to read the contents of
a union", and therefore can't apply when not directly using an actual member to
read it. What I said about allowing indirect access was specific to the special
guarantee from 6.5.2.3p6, and was not in any way intended to imply that
indirect  type punning using a union is allowed when that guarantee doesn't
apply.

> 1) all type-based alias analysis is effectively impossible

Alias analysis is only affected by the special guarantee if
a) the types involved are both struct types
b) both struct types are members of the same union
c) the struct types share a common initial sequence
d) the code in question inspects the value of one of the members of the common
initial sequence.
e) a completed declaration of the union type that they are members of is
visible  at the point in the code where the inspection occurrs.

It seems to me that the overwhelming majority of cases will fail to meet at
least one of those requirements, so type-based alias analysis is still
possible, it's just made more complicated by the need to check for those
things.


> The real problem is that "it is permitted to inspect" doesn't say how one
> should perform an "inspection" nor what the result should be. You want it to
> mean "access (read) the structure member in the normal way and have its
> value match that of the corresponding structure member from the common
> initial sequence of the active member". But the "special guarantee" grants a
> permission, which is most easily read as not doing anything other than
> specifying that a certain action (reading a struct member) doesn't have
> undefined behaviour in certain circumstances.

Well, that's sufficiently vague that I can agree with it. It's the fact that,
in other circumstance, the behavior is undefined, that allows optimizations
that would fail if the pointers alias each other. Such optimizations are
therefore not allowed in the circumstances where 6.5.3.2p6 applies.

> It's not even actually explicated that the value read should match that of
> the corresponding common-initial-sequence member of the struct object that
> is the active member of the union object in question; in thinking that it
> should be, we're already making the assumption that this clause is intended
> to permit a certain case of type-punning. But, as I noted above, if
> type-punning is generally allowed,

Which is NOT what I claimed.

> ... and if accessing via the union
> "immediately" has the same  semantics as taking the address of the union
> member and accessing via the resulting pointer

Which I only claimed to be true when the special guarantee applies.

> ... - then the clause isn't
> necessary anyway,

Since I didn't make the general claims you're asserting that I made, the clause
is necessary.

> ... except to mandate that the common-initial-sequence layout
> is identical between distinct structs which are punned in this way, and in
> that case what is the point of requiring that the union declaration be
> visible?

It's a pre-condition for the indirect access to be valid, which would otherwise
not be allowed.

> ... (Unless you want to argue that the point is to mandate the common
> initial sequence layout is necessarily identical only if the union
> declaration is visible;

No, I think the primary point is to disallow optimizations based upon the
normal assumption that the two struct types can't alias each other. However,
the standard does not otherwise constrain the layout of any member of a struct
type other than the first, so in any context where 6.5.2.3p6 doesn't interfere,
the common initial sequence is allowed to have different layouts in the
different struct types. I can't imagine any good reason for an implementation
to do so - I'd expect that for any given value of n, for any given
implementation of C, the location within a struct of the nth member is
determined uniquely by the types of the preceding members - but the standard
doesn't require that to be the case.

> So for your interpretation I believe you need that either:
> 
> 1) type punning via a union is not normally permissible, despite the
> footnote claiming it is, and

It is permitted to use a 

[Bug libstdc++/83140] assoc_legendre returns negated value when m is odd

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83140

emsr at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-05-01
 Ever confirmed|0   |1

[Bug middle-end/85586] [8/9 Regression] Optimizer produces different result on -O2 and -O3

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85586

--- Comment #3 from rsandifo at gcc dot gnu.org  
---
Testing a patch.

[Bug web/85578] broken links in gcc-8.0.1-RC-20180427/INSTALL/specific.html, and out of date prerequisites.html

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85578

--- Comment #4 from Jakub Jelinek  ---
Author: jakub
Date: Tue May  1 15:29:05 2018
New Revision: 259801

URL: https://gcc.gnu.org/viewcvs?rev=259801=gcc=rev
Log:
PR web/85578
* doc/install.texi2html: Replace _002d with - and _002a with * in
generated html files using sed.

Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/doc/install.texi2html

[Bug web/85578] broken links in gcc-8.0.1-RC-20180427/INSTALL/specific.html, and out of date prerequisites.html

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85578

--- Comment #3 from Jakub Jelinek  ---
Author: jakub
Date: Tue May  1 15:26:36 2018
New Revision: 259799

URL: https://gcc.gnu.org/viewcvs?rev=259799=gcc=rev
Log:
PR web/85578
* doc/install.texi2html: Replace _002d with - and _002a with * in
generated html files using sed.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/doc/install.texi2html

[Bug tree-optimization/84011] Optimize switch table with run-time relocation

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84011

--- Comment #13 from Peter Cordes  ---
(In reply to Jakub Jelinek from comment #10)
> ??  That is the task for the linker SHF_MERGE|SHF_STRINGS handling.
> Why should gcc duplicate that?

Because gcc would benefit from knowing if merging makes the total block of
strings for a switch() table short enough to use a uint8_t offset[] instead of
uint16_t.

If we don't know at compile time, we'd have to be conservative and potentially
use a wider offset table.  (Although as Joseph points out
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85585#c2, without more linker
support for this we could end up missing out on literal merging across
compilation units.  So perhaps a first step in applying this idea would be to
use 32-bit offsets from the start of the .rodata.str1.1 section, so we can
still let the linker merge strings and end up with them non-contiguous without
having to force the one that gets kept to be the one that's part of our block
of strings.)

[Bug c/65892] gcc fails to implement N685 aliasing of union members

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65892

--- Comment #58 from Davin McCall  ---
(In reply to Andrew Haley from comment #57)
> (In reply to Davin McCall from comment #52)
> > (In reply to Andrew Haley from comment #45)
> > > (In reply to Davin McCall from comment #44)
> > > > The "one special guarantee" clause appears in the section describing 
> > > > union
> > > > member access via the "." or "->" operators, implying that it only 
> > > > applies
> > > > to the access of union members via the union.
> > > 
> > > I don't believe that's what is intended, or that you can make such a
> > > conclusion based on the section in which the rule appears.  It applies
> > > to other accesses too, as is (somewhat) made clear by the rationale in
> > > http://www.open-std.org/jtc1/sc22/wg14/www/docs/n685.htm:
> > 
> > It certainly may not be what is intended by N685, but I think it's normally
> > reasonable to conclude that a statement in a particular section of a
> > document applies to that section and not more universally than that; in this
> > case, the "universal" interpretation flatly contradicts the strict aliasing
> > rule and any other rule which would otherwise disallow access, which seems
> > extremely problematic to me.
> > 
> > In general it appears the committee have asserted that the "universal"
> > interpretation (which since N685 requires visibility of the union
> > declaration to be effective) is the correct one, but my argument
> 
> ... doesn't really matter from a practical point of view, does it?
> That ship has sailed.

Well, if the amendment doesn't make sense, I'd say it matters from a practical
point of view, yes. It can always be amended again.

> > is that the actual text of the standard strongly implies something
> > different, and that the interpretation being pushed instead turns
> > another portion of the standard text into nonsense.
> 
> I don't think that's it really does, but I think we're done.

I've laid it out as best as I can in comment #56, and certainly don't have more
to add.

[Bug c/65892] gcc fails to implement N685 aliasing of union members

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65892

--- Comment #57 from Andrew Haley  ---
(In reply to Davin McCall from comment #52)
> (In reply to Andrew Haley from comment #45)
> > (In reply to Davin McCall from comment #44)
> > > The "one special guarantee" clause appears in the section describing union
> > > member access via the "." or "->" operators, implying that it only applies
> > > to the access of union members via the union.
> > 
> > I don't believe that's what is intended, or that you can make such a
> > conclusion based on the section in which the rule appears.  It applies
> > to other accesses too, as is (somewhat) made clear by the rationale in
> > http://www.open-std.org/jtc1/sc22/wg14/www/docs/n685.htm:
> 
> It certainly may not be what is intended by N685, but I think it's normally
> reasonable to conclude that a statement in a particular section of a
> document applies to that section and not more universally than that; in this
> case, the "universal" interpretation flatly contradicts the strict aliasing
> rule and any other rule which would otherwise disallow access, which seems
> extremely problematic to me.
> 
> In general it appears the committee have asserted that the "universal"
> interpretation (which since N685 requires visibility of the union
> declaration to be effective) is the correct one, but my argument

... doesn't really matter from a practical point of view, does it?
That ship has sailed.

> is that the actual text of the standard strongly implies something
> different, and that the interpretation being pushed instead turns
> another portion of the standard text into nonsense.

I don't think that's it really does, but I think we're done.

[Bug c++/85589] New: Non type template parameter should allow object with no linkage

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85589

Bug ID: 85589
   Summary: Non type template parameter should allow object with
no linkage
   Product: gcc
   Version: 7.3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gufideg at gmail dot com
  Target Milestone: ---

Even though n4268 is marked as supported fully here:
https://gcc.gnu.org/projects/cxx-status.html, GCC does not yet support passing
the address or reference to an object with no linkage.

Such code should compile under C++17:

template struct foo {};

int main() {
static auto v = "str";
(void) foo {};
}

But fail with:

error: 'v' is not a valid template argument for type 'const char*&' because
object 'v' does not have linkage

 (void) foo {};
 ^

Such code compiles under clang 6.0.0.

Live example: https://godbolt.org/g/aXjDBg

[Bug tree-optimization/85585] switch to select a string based on an enum can profitably optimize away the table of pointers/offsets into fixed-length char[] blocks. Or use byte offsets into a string

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85585

--- Comment #2 from joseph at codesourcery dot com  ---
On Tue, 1 May 2018, peter at cordes dot ca wrote:

> The current strings + pointer-table implementation doesn't merge string
> literals where one string is a suffix of another; this is another a

The linker does that, as well as merging identical strings in different 
translation units, via strings going in specially marked string sections 
(".section .rodata.str1.1,"aMS",@progbits,1").  These proposed 
optimizations would interfere with such linker optimizations, so they 
might not be a code size win.

[Bug tree-optimization/84011] Optimize switch table with run-time relocation

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84011

--- Comment #12 from Peter Cordes  ---
(In reply to Jakub Jelinek from comment #10)
> (In reply to Peter Cordes from comment #9)
> > gcc already totally misses optimizations here where one string is a suffix
> > of another.  "mii" could just be a pointer to the 3rd byte of "sgmii", but
> > we instead duplicate all the characters.  That's where major savings are
> > possible for this function.
> 
> ??  That is the task for the linker SHF_MERGE|SHF_STRINGS handling.
> Why should gcc duplicate that?

Oops, right I was only looking at gcc's asm output, didn't check an actual
linked binary.

Will the linker currently catch a case like this?

.LC_base:
.LC2: .string "mii"
.LC3: .string "gmii"

table:
.byte  .LC2 - .LC_base,  .LC3 - .LC_base

and drop .string "mii" entirely + rewrite the table to
.byte  .LC3+1 - .LC_base,  .LC3 - .LC_base

(This discussion should probably be happening on bug 85585.)

Sorry I don't know the actual mechanism by which gcc signals to the linker that
it can / can't merge.  I guess only in some sections?  Because gcc couldn't
allow it if was emitting an array like this, where dropping a string would
change the offsets for later data and break offset calculations:

const struct { char str[11]; } table[] = { {"mii"}, {"gmii"} };

[Bug tree-optimization/85588] -fwrapv miscompilation

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85588

Marek Polacek  changed:

   What|Removed |Added

   Keywords||wrong-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-05-01
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed.

[Bug fortran/85507] [6/7/8/9 Regression] ICE in gfc_dep_resolver, at fortran/dependency.c:2258

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85507

--- Comment #12 from vehre at gcc dot gnu.org ---
This patch is not referring to the failures in Opencoarrays. The fix for #56 is
in Opencoarray's pull request #528. The other one has nothing to do with this
initial issue and is not of my current concern.

[Bug tree-optimization/85588] New: -fwrapv miscompilation

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85588

Bug ID: 85588
   Summary: -fwrapv miscompilation
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: kristerw at gcc dot gnu.org
  Target Milestone: ---

GCC miscompiles gcc/testsuite/gcc.dg/torture/pr57656.c when using -fwrapv

  > gcc -fwrapv pr57656.c
  > ./a.out
  Abort (core dumped)

The problem seems to be exactly the same as in PR57656 (but when using
-fwrapv):
  t = 1 - ((a - b) / c);
is changed to
  t = (b - a) / c + 1;
which is not the same in this case where both (a - b) and (b - a) have the
value 0x8000.

This fails in GCC 6 and newer versions. Compiling using GCC 5 produces the
correct result.

[Bug middle-end/85586] [8/9 Regression] Optimizer produces different result on -O2 and -O3

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85586

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rsandifo at gcc dot 
gnu.org

--- Comment #2 from rsandifo at gcc dot gnu.org  
---
Mine.

[Bug c++/85587] [8/9 Regression] bogus error: ‘F’ was not declared in this scope

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85587

Marek Polacek  changed:

   What|Removed |Added

   Target Milestone|--- |8.2
Summary|bogus error: ‘F’ was not|[8/9 Regression] bogus
   |declared in this scope  |error: ‘F’ was not declared
   ||in this scope

[Bug c++/85587] New: bogus error: ‘F’ was not declared in this scope

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85587

Bug ID: 85587
   Summary: bogus error: ‘F’ was not declared in this scope
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

template 
struct S
{
  enum class T
  {
E, F
  };
  void foo ();
};

template 
void S::foo ()
{
  decltype (T::F) t;
}

void
bar ()
{
  S<0> s;
  s.foo ();
}

is rejected since r251438.

[Bug fortran/85507] [6/7/8/9 Regression] ICE in gfc_dep_resolver, at fortran/dependency.c:2258

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85507

--- Comment #11 from Dominique d'Humieres  ---
> > It does with reverting the change in dependency.c with two failures in the
> > test suite:
> > 
> >  17 - alloc_comp_multidim_shape (Failed)
> >  56 - get-put-allocatable-comp (Failed)
>
> Well, that's kind of misleading. ...

Sorry about the confusion. I as referring to comment 2.

Note that the full patch does not fix the above failures.

[Bug go/85429] Several gotools tests FAIL with Solaris as

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85429

--- Comment #11 from ian at gcc dot gnu.org  ---
Author: ian
Date: Tue May  1 14:08:44 2018
New Revision: 259797

URL: https://gcc.gnu.org/viewcvs?rev=259797=gcc=rev
Log:
PR go/85429
cmd/go: support more Solaris assembler syntaxes

Patch by Rainer Orth.

Reviewed-on: https://go-review.googlesource.com/110563

Modified:
trunk/gcc/go/gofrontend/MERGE
trunk/libgo/go/cmd/go/internal/work/buildid.go

[Bug c++/85580] [8 Regression] "conflicting C language linkage declaration" warning for variables with identical names in `extern "C"` functions

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85580

Jason Merrill  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Jason Merrill  ---
Fixed.

[Bug fortran/85507] [6/7/8/9 Regression] ICE in gfc_dep_resolver, at fortran/dependency.c:2258

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85507

--- Comment #10 from vehre at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #9)
> > Thanks for the proposed bugfix. Did you check that also OpenCoarrays 2.0
> > compiles again with this fix?
> 
> It does with reverting the change in dependency.c with two failures in the
> test suite:
> 
>17 - alloc_comp_multidim_shape (Failed)
>56 - get-put-allocatable-comp (Failed)

Well, that's kind of misleading. The change in the dependency.c introduced by
the patch I proposed above should not be reverted. This patch rather reverts
one of my previous patches.

[Bug middle-end/85586] [8/9 Regression] Optimizer produces different result on -O2 and -O3

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85586

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org
   Target Milestone|--- |8.0

[Bug tree-optimization/84011] Optimize switch table with run-time relocation

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84011

--- Comment #11 from Jan Hubicka  ---
> 
> ??  That is the task for the linker SHF_MERGE|SHF_STRINGS handling.
> Why should gcc duplicate that?
I suppose there would be small room for improvements where GCC could use the
fact that one string's address is actually address of another string + offset.
That may save some relocations.

Honza

[Bug tree-optimization/84011] Optimize switch table with run-time relocation

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84011

--- Comment #10 from Jakub Jelinek  ---
(In reply to Peter Cordes from comment #9)
> gcc already totally misses optimizations here where one string is a suffix
> of another.  "mii" could just be a pointer to the 3rd byte of "sgmii", but
> we instead duplicate all the characters.  That's where major savings are
> possible for this function.

??  That is the task for the linker SHF_MERGE|SHF_STRINGS handling.
Why should gcc duplicate that?

[Bug middle-end/85586] [8/9 Regression] Optimizer produces different result on -O2 and -O3

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85586

Jonathan Wakely  changed:

   What|Removed |Added

 CC||rsandifo at gcc dot gnu.org

--- Comment #1 from Jonathan Wakely  ---
Seems to be due to r256644

[Bug fortran/85507] [6/7/8/9 Regression] ICE in gfc_dep_resolver, at fortran/dependency.c:2258

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85507

--- Comment #9 from Dominique d'Humieres  ---
> Thanks for the proposed bugfix. Did you check that also OpenCoarrays 2.0
> compiles again with this fix?

It does with reverting the change in dependency.c with two failures in the test
suite:

 17 - alloc_comp_multidim_shape (Failed)
 56 - get-put-allocatable-comp (Failed)

[Bug middle-end/84955] [7 Regression] Incorrect OpenACC tile expansion

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84955

Tom de Vries  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Tom de Vries  ---
Patch backported to gcc-7-branch, marking resolved-fixed.

  1   2   >