public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/56580] New: Internal compiler error when trying to compile a sequence of NOPs inside a loop
@ 2013-03-09 17:34 ahyangyi at gmail dot com
  2013-03-09 17:37 ` [Bug c/56580] " ahyangyi at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ahyangyi at gmail dot com @ 2013-03-09 17:34 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56580

             Bug #: 56580
           Summary: Internal compiler error when trying to compile a
                    sequence of NOPs inside a loop
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ahyangyi@gmail.com


Created attachment 29629
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29629
The code that triggers the bug.

I am trying to do a silly thing: to produce a program that's bigger than my L1
Instruction cache but smaller than my L2 cache, so the speed of the L2 cache
can be measured.

My implementation is simple: I put a sequence of NOPs as inline assembly,
inside a for-loop. When I compile the code (see attachment) with -O2 or -O3
option, gcc 4.7.2 throws out internal error.

Not that the bug is anywhere harmful. I can happily do without any optimization
flags in this case. But I still think it's worth reporting, as fixing it may be
helpful to prevent other potential bugs. By the way, my other versions of gcc
(4.2.4, 4.4.7, 4.5.4) all work without any problems.

The code in the attachment uses 12288 NOPS inside the for-loop, which loops
1000 times. Lowering the former to 10240 or lowering the latter to 500 both
seem to eliminate the problem.

I am using Gentoo Linux. When I compile my gcc-4.7.2 using Portage, I didn't
set any optimization flags other than -O2 and -march=native. My machine is an
i7 box.

Finally, the following is the output of `gcc -v -save-temps -O2 GCC4.7-bug.c`:

Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.2/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.2/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.7.2-r1/work/gcc-4.7.2/configure --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.2
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.2/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.2
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.2/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.2/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.2/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --without-ppl --without-cloog --enable-lto --enable-nls
--without-included-gettext --with-system-zlib --enable-obsolete
--disable-werror --enable-secureplt --enable-multilib
--with-multilib-list=m32,m64 --enable-libmudflap --disable-libssp
--enable-libgomp
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.7.2/python
--enable-checking=release --enable-libstdcxx-time
--enable-languages=c,c++,java,go,fortran --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all
--with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.7.2-r1 p1.4,
pie-0.5.5' --enable-plugin
Thread model: posix
gcc version 4.7.2 (Gentoo 4.7.2-r1 p1.4, pie-0.5.5) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.2/cc1 -E -quiet -v GCC4.7-bug.c
-mtune=generic -march=x86-64 -O2 -fpch-preprocess -o GCC4.7-bug.i
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.2/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.2/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.2/cc1 -fpreprocessed GCC4.7-bug.i
-quiet -dumpbase GCC4.7-bug.c -mtune=generic -march=x86-64 -auxbase GCC4.7-bug
-O2 -version -o GCC4.7-bug.s
GNU C (Gentoo 4.7.2-r1 p1.4, pie-0.5.5) version 4.7.2 (x86_64-pc-linux-gnu)
        compiled by GNU C version 4.7.2, GMP version 5.0.2, MPFR version 3.1.1,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C (Gentoo 4.7.2-r1 p1.4, pie-0.5.5) version 4.7.2 (x86_64-pc-linux-gnu)
        compiled by GNU C version 4.7.2, GMP version 5.0.2, MPFR version 3.1.1,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: b73b2677ca23c504b32a2ee915f40344
GCC4.7-bug.c: In function ‘main’:
GCC4.7-bug.c:12303:1: internal compiler error: in account_size_time, at
ipa-inline-analysis.c:601
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.gentoo.org/> for instructions.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/56580] Internal compiler error when trying to compile a sequence of NOPs inside a loop
  2013-03-09 17:34 [Bug c/56580] New: Internal compiler error when trying to compile a sequence of NOPs inside a loop ahyangyi at gmail dot com
@ 2013-03-09 17:37 ` ahyangyi at gmail dot com
  2013-03-11 10:23 ` [Bug tree-optimization/56580] " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ahyangyi at gmail dot com @ 2013-03-09 17:37 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56580

--- Comment #1 from Yi Yang <ahyangyi at gmail dot com> 2013-03-09 17:37:11 UTC ---
Oops, perhaps I should report this to the Gentoo Bugzilla?

However, I don't see an option to delete this. I will apologize if you think
it's not appropriate here.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/56580] Internal compiler error when trying to compile a sequence of NOPs inside a loop
  2013-03-09 17:34 [Bug c/56580] New: Internal compiler error when trying to compile a sequence of NOPs inside a loop ahyangyi at gmail dot com
  2013-03-09 17:37 ` [Bug c/56580] " ahyangyi at gmail dot com
@ 2013-03-11 10:23 ` rguenth at gcc dot gnu.org
  2013-03-14 16:25 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-03-11 10:23 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56580

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-03-11
                 CC|                            |andi-gcc at firstfloor dot
                   |                            |org, hubicka at gcc dot
                   |                            |gnu.org
          Component|c                           |tree-optimization
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-11 10:22:17 UTC ---
Andi has a patch for this IIRC.  But instead of

  /* Watch overflow that might result from insane profiles.  */
  if (time > MAX_TIME * INLINE_TIME_SCALE)
    time = MAX_TIME * INLINE_TIME_SCALE;
  gcc_assert (time >= 0);

we should "deal" with the overflow, not ICE on it.  Like by doing

  if (time < 0
      || time > MAX_TIME * INLINE_TIME_SCALE)
    time = MAX_TIME * INLINE_TIME_SCALE;


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/56580] Internal compiler error when trying to compile a sequence of NOPs inside a loop
  2013-03-09 17:34 [Bug c/56580] New: Internal compiler error when trying to compile a sequence of NOPs inside a loop ahyangyi at gmail dot com
  2013-03-09 17:37 ` [Bug c/56580] " ahyangyi at gmail dot com
  2013-03-11 10:23 ` [Bug tree-optimization/56580] " rguenth at gcc dot gnu.org
@ 2013-03-14 16:25 ` pinskia at gcc dot gnu.org
  2013-03-20 12:06 ` rguenth at gcc dot gnu.org
  2014-10-08  3:32 ` ak at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-03-14 16:25 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56580

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-03-14 16:24:23 UTC ---
*** Bug 56618 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/56580] Internal compiler error when trying to compile a sequence of NOPs inside a loop
  2013-03-09 17:34 [Bug c/56580] New: Internal compiler error when trying to compile a sequence of NOPs inside a loop ahyangyi at gmail dot com
                   ` (2 preceding siblings ...)
  2013-03-14 16:25 ` pinskia at gcc dot gnu.org
@ 2013-03-20 12:06 ` rguenth at gcc dot gnu.org
  2014-10-08  3:32 ` ak at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-03-20 12:06 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56580

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jan.smets@alcatel-lucent.co
                   |                            |m

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-20 12:06:05 UTC ---
*** Bug 56664 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/56580] Internal compiler error when trying to compile a sequence of NOPs inside a loop
  2013-03-09 17:34 [Bug c/56580] New: Internal compiler error when trying to compile a sequence of NOPs inside a loop ahyangyi at gmail dot com
                   ` (3 preceding siblings ...)
  2013-03-20 12:06 ` rguenth at gcc dot gnu.org
@ 2014-10-08  3:32 ` ak at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ak at gcc dot gnu.org @ 2014-10-08  3:32 UTC (permalink / raw)
  To: gcc-bugs

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

ak at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ak at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #5 from ak at gcc dot gnu.org ---
Fixed since some time in trunk with 

2013-09-08  Andi Kleen  <ak@linux.intel.com>

        * tree-inline.c (estimate_num_insns): Limit asm cost to 1000.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-10-08  3:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-09 17:34 [Bug c/56580] New: Internal compiler error when trying to compile a sequence of NOPs inside a loop ahyangyi at gmail dot com
2013-03-09 17:37 ` [Bug c/56580] " ahyangyi at gmail dot com
2013-03-11 10:23 ` [Bug tree-optimization/56580] " rguenth at gcc dot gnu.org
2013-03-14 16:25 ` pinskia at gcc dot gnu.org
2013-03-20 12:06 ` rguenth at gcc dot gnu.org
2014-10-08  3:32 ` ak at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).