[Bug c/58048] New: internal compiler error: Max. number of generated reload insns per insn is achieved (90)

2013-08-01 Thread n-gcc at nn dot kiev.ua
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58048

Bug ID: 58048
   Summary: internal compiler error: Max. number of generated
reload insns per insn is achieved (90)
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: n-gcc at nn dot kiev.ua

Created attachment 30586
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30586&action=edit
preprocessed input file

Observed both on 4.8.1 and 4.9.0. It gives the same message as #55247 but the
latter is declared fixed for 4.8.0. Compiler versions are from FreeBSD ports.

Example for gcc 4.8.1. Command:

gcc48 -v -c d.c -Wall -Wextra -g3 -Og -save-temps

Its output:

Using built-in specs.
COLLECT_GCC=gcc48
Target: i386-portbld-freebsd9.1
Configured with: ./../gcc-4.8-20130418/configure --disable-nls
--libdir=/usr/local/lib/gcc48 --libexecdir=/usr/local/libexec/gcc48
--program-suffix=48 --with-as=/usr/local/bin/as --with-gmp=/usr/local
--with-gxx-include-dir=/usr/local/lib/gcc48/include/c++/
--with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local
--with-pkgversion='FreeBSD Ports Collection' --with-system-zlib
--disable-libgcj --enable-languages=c,c++,objc,fortran --prefix=/usr/local
--mandir=/usr/local/man --infodir=/usr/local/info/gcc48
--build=i386-portbld-freebsd9.1
Thread model: posix
gcc version 4.8.1 20130418 (prerelease) (FreeBSD Ports Collection) 
COLLECT_GCC_OPTIONS='-v' '-c' '-Wall' '-Wextra' '-g3' '-Og' '-save-temps'
'-mtune=generic' '-march=i486'
 /usr/local/libexec/gcc48/gcc/i386-portbld-freebsd9.1/4.8.1/cc1 -E -quiet -v
-dD d.c -mtune=generic -march=i486 -Wall -Wextra -g3 -fworking-directory -Og
-fpch-preprocess -o d.i
ignoring nonexistent directory
"/usr/local/lib/gcc48/gcc/i386-portbld-freebsd9.1/4.8.1/../../../../../i386-portbld-freebsd9.1/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc48/gcc/i386-portbld-freebsd9.1/4.8.1/include
 /usr/local/include
 /usr/local/lib/gcc48/gcc/i386-portbld-freebsd9.1/4.8.1/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-c' '-Wall' '-Wextra' '-g3' '-Og' '-save-temps'
'-mtune=generic' '-march=i486'
 /usr/local/libexec/gcc48/gcc/i386-portbld-freebsd9.1/4.8.1/cc1 -fpreprocessed
d.i -quiet -dumpbase d.c -mtune=generic -march=i486 -auxbase d -g3 -Og -Wall
-Wextra -version -o d.s
GNU C (FreeBSD Ports Collection) version 4.8.1 20130418 (prerelease)
(i386-portbld-freebsd9.1)
compiled by GNU C version 4.8.1 20130418 (prerelease), GMP version
5.1.1, MPFR version 3.1.2, MPC version 0.9
warning: GMP header version 5.1.1 differs from library version 5.1.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C (FreeBSD Ports Collection) version 4.8.1 20130418 (prerelease)
(i386-portbld-freebsd9.1)
compiled by GNU C version 4.8.1 20130418 (prerelease), GMP version
5.1.1, MPFR version 3.1.2, MPC version 0.9
warning: GMP header version 5.1.1 differs from library version 5.1.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: b4e187455a377c1d9edc9370c28ad081
d.c: In function 'div3':
d.c:93:15: warning: unused parameter 'n' [-Wunused-parameter]
 div3(unsigned n, unsigned d, unsigned *qp, unsigned *rp, unsigned *t)
   ^
d.c:93:40: warning: unused parameter 'qp' [-Wunused-parameter]
 div3(unsigned n, unsigned d, unsigned *qp, unsigned *rp, unsigned *t)
^
d.c:93:54: warning: unused parameter 'rp' [-Wunused-parameter]
 div3(unsigned n, unsigned d, unsigned *qp, unsigned *rp, unsigned *t)
  ^
d.c:107:1: internal compiler error: Max. number of generated reload insns per
insn is achieved (90)

 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Output for 4.9.0:

Using built-in specs.
COLLECT_GCC=gcc49
Target: i386-portbld-freebsd9.1
Configured with: ./../gcc-4.9-20130630/configure --disable-nls
--libdir=/usr/loc
al/lib/gcc49 --libexecdir=/usr/local/libexec/gcc49 --program-suffix=49
--with-as
=/usr/local/bin/as --with-gmp=/usr/local
--with-gxx-include-dir=/usr/local/lib/g
cc49/include/c++/ --with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local 
--with-pkgversion='FreeBSD Ports Collection' --with-system-zlib
--disable-libgcj
 --enable-languages=c,c++,objc,fortran --prefix=/usr/local
--mandir=/usr/local/m
an --infodir=/usr/local/info/gcc49 --build=i386-portbld-freebsd9.1
Thread model: pos

[Bug tree-optimization/61569] New: faggressive-loop-optimizations overoptimize loop checks with unpredicted result

2014-06-19 Thread n-gcc at nn dot kiev.ua
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61569

Bug ID: 61569
   Summary: faggressive-loop-optimizations overoptimize loop
checks with unpredicted result
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: n-gcc at nn dot kiev.ua

The following program performs 112 iterations (and stop on x==1) instead of
expected 10 ones.

#include 

int main()
{
int i, x = 27;
for (i = 0; i < 10; ++i)
{
printf("%11d : %11d : %d\n", i, i*10, x);
if (x==1) break;
x = x%2 ? x*3+1 : x/2;
}
return 0;
}

With a small change, it, instead, limits itself to 3 iterations.

#include 

int main()
{
int i, j, x = 27;
for (i = j = 0; i < 10; ++i, ++j)
{
printf("%11d : %11d : %d\n", i, j*10, x);
if (x==1) break;
x = x%2 ? x*3+1 : x/2;
}
return 0;
}

Conditions to represent the issue are:
1. gcc after 4.8.0 (my versions gcc48-4.8.4.s20140605 and gcc49-4.9.1.s20140611
from FreeBSD ports).
2. -O2 or higher, or -Os.

The issue goes after any of the following options added:
* -fno-aggressive-loop-optimizations
* -fno-strict-overflow
* -fwrapv or -ftrapv (obviously)

Stage dump analysis shows that loop exit condition check (i<10 in that code
examples, i<=9 internally after some change) is gone away at 056t.cunrolli.

Adding of -Wstrict-overflow of any level doesn't cause warning emission.

The similar issue was reported in #58143 comment 9, and #53265 seems devoted to
lack of warning, but I'm not sure cases are equal.

Disclaimer: I'm aware of standard's statement "signed integer overflow is UB"
but I'm confident that a respected common-goal compiler should thoroughly limit
this UB to result value of the operator itself and avoid expanding it to any
other program action.

Thanks to: livejournal.com user _winnie for issue finding; user kodt_rsdn
(Nikolay Merkin) for the clear example designing; Serge Ryabchun for diagnosing
-faggressive-loop-optimizations influence.


[Bug tree-optimization/61569] faggressive-loop-optimizations overoptimize loop checks with unpredicted result

2014-06-23 Thread n-gcc at nn dot kiev.ua
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61569

--- Comment #2 from Valentin Nechayev  ---
(In reply to Richard Biener from comment #1)

[overquoting skipped]
> Unfortunately that's not possible.

What about absense of warning under -Wstrict-overflow?