public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/106642] New: cc1 compiler hangs when cross-compiling ring_buffer.c (from kernel/events) on Aarch64
@ 2022-08-16 13:29 pivanov at hotmail dot com
  2022-08-16 13:31 ` [Bug c/106642] " pivanov at hotmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: pivanov at hotmail dot com @ 2022-08-16 13:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106642
           Summary: cc1 compiler hangs when cross-compiling ring_buffer.c
                    (from kernel/events) on Aarch64
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pivanov at hotmail dot com
  Target Milestone: ---

Compiler hangs forever and consumes all available memory when cross-compiling
android kernel tree.

The file that it hangs on is kernel/events/ring_buffer.c

You may find the preprocessed ring_buffer.i attached.

Compiler version and flags (source code checked out @ commit 1c596391e):
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=1c596391e150a6b0c55960c1c1cf1da76ea78230
------------------------------------------------------------------------

/storage/gcc-arm64/bin/aarch64-elf-gcc -v
Using built-in specs.
COLLECT_GCC=/storage/gcc-arm64/bin/aarch64-elf-gcc
COLLECT_LTO_WRAPPER=/storage/gcc-arm64/bin/../libexec/gcc/aarch64-elf/13.0.0/lto-wrapper
Target: aarch64-elf
Configured with: ../gcc/configure --target=aarch64-elf CFLAGS='-flto
-flto-compression-level=10 -O3 -pipe -ffunction-sections -fdata-sections'
CXXFLAGS='-flto -flto-compression-level=10 -O3 -pipe -ffunction-sections
-fdata-sections' --prefix=/storage/gcc-arm64 --disable-decimal-float
--disable-gcov --disable-libffi --disable-libgomp --disable-libmudflap
--disable-libquadmath --disable-libstdcxx-pch --disable-nls --disable-shared
--disable-docs --enable-default-ssp --enable-languages=c,c++
--enable-threads=posix --with-pkgversion='Eva GCC' --with-newlib --with-gnu-as
--with-gnu-ld --with-linker-hash-style=gnu --with-sysroot
--with-headers=/usr/include
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20220816 (Bleeding Edge) (Eva GCC)



Command line used that hangs compiler:
----------------------------------------

/storage/gcc-arm64/bin/aarch64-elf-gcc -Wp,-MD,kernel/events/.ring_buffer.o.d
-nostdinc -isystem
/ext/gcc-arm64-gcc-master/bin/../lib/gcc/aarch64-elf/13.0.0/include
-I../arch/arm64/include -I./arch/arm64/include/generated  -I../include
-I./include -I../arch/arm64/include/uapi -I./arch/arm64/include/generated/uapi
-I../include/uapi -I./include/generated/uapi -include
../include/linux/kconfig.h  -I../kernel/events -Ikernel/events -D__KERNEL__
-mlittle-endian -DKASAN_SHADOW_SCALE_SHIFT=3 -Wall -Wundef -Wstrict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar
-Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE
-fno-gcse -mgeneral-regs-only -DCONFIG_AS_LSE=1 -DCONFIG_VDSO32=1
-fno-asynchronous-unwind-tables -fno-pic -mabi=lp64
-DCONFIG_ARCH_SUPPORTS_INT128 -DKASAN_SHADOW_SCALE_SHIFT=3 -O3
-mcpu=cortex-a76.cortex-a55+crypto+crc+lse+fp16+rcpc+rdma+dotprod
-mtune=cortex-a76.cortex-a55 -fgraphite-identity -floop-nest-optimize
-fno-semantic-interposition -fdevirtualize-at-ltrans -fipa-pta -fno-plt
-fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation
-Wno-format-overflow -Wno-int-in-bool-context -Wno-address-of-packed-member
-Wno-attribute-alias -O3
-mcpu=cortex-a76.cortex-a55+crypto+crc+lse+fp16+rcpc+rdma+dotprod
-mtune=cortex-a76.cortex-a55 -fgraphite-identity -floop-nest-optimize
-fno-semantic-interposition -fdevirtualize-at-ltrans -fipa-pta -fno-plt
-fno-allow-store-data-races -DCC_HAVE_ASM_GOTO -fstack-protector-strong
-fno-delete-null-pointer-checks -Wno-unused-but-set-variable
-Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls
-fno-var-tracking-assignments -ffunction-sections -fdata-sections
-Wdeclaration-after-statement -Wno-pointer-sign -Wno-stringop-truncation
-Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict
-Wno-maybe-uninitialized -fno-strict-overflow -fno-merge-all-constants
-fmerge-constants -fno-stack-check -Werror=implicit-int
-Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types
-Werror=designated-init -fmacro-prefix-map=../= -fgcse-sm
-Wno-packed-not-aligned    -DKBUILD_BASENAME='"ring_buffer"' 
-DKBUILD_MODNAME='"ring_buffer"' -c -o kernel/events/ring_buffer.o
../kernel/events/ring_buffer.c

--------------------------------------------

The same command line hangs on the attached preprocessed file (ring_buffer.i)
so the bug should be fully reproducible.

I did try to alter options from the command line above but couldn't make it to
compile no matter what options have been removed.

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

* [Bug c/106642] cc1 compiler hangs when cross-compiling ring_buffer.c (from kernel/events) on Aarch64
  2022-08-16 13:29 [Bug c/106642] New: cc1 compiler hangs when cross-compiling ring_buffer.c (from kernel/events) on Aarch64 pivanov at hotmail dot com
@ 2022-08-16 13:31 ` pivanov at hotmail dot com
  2022-08-16 13:56 ` [Bug middle-end/106642] " rearnsha at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pivanov at hotmail dot com @ 2022-08-16 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from pivanov at hotmail dot com ---
Created attachment 53466
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53466&action=edit
Preprocessed file that triggers the hang

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

* [Bug middle-end/106642] cc1 compiler hangs when cross-compiling ring_buffer.c (from kernel/events) on Aarch64
  2022-08-16 13:29 [Bug c/106642] New: cc1 compiler hangs when cross-compiling ring_buffer.c (from kernel/events) on Aarch64 pivanov at hotmail dot com
  2022-08-16 13:31 ` [Bug c/106642] " pivanov at hotmail dot com
@ 2022-08-16 13:56 ` rearnsha at gcc dot gnu.org
  2022-08-16 14:00 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2022-08-16 13:56 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-08-16
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
Seems to be stuck in a recursive loop:

#9  0x0000000001700472 in generic_simplify_GT_EXPR (loc=2147516709, 
    type=0x7ffff752a5e8, _p0=0x7ffff5a65900, _p1=0x7ffff72fb288, 
    code=<optimized out>) at generic-match.cc:75812
#10 0x00000000017ae6ee in generic_simplify (loc=loc@entry=2147516709, 
    code=code@entry=GT_EXPR, type=type@entry=0x7ffff752a5e8, 
    _p0=_p0@entry=0x7ffff5a65900, _p1=_p1@entry=0x7ffff72fb288)
    at generic-match.cc:93192
#11 0x0000000000c33376 in fold_binary_loc (loc=2147516709, code=GT_EXPR, 
    type=0x7ffff752a5e8, op0=0x7ffff5a65900, op1=0x7ffff72fb288)
    at /home/rearnsha/gnusrc/gcc-cross/master/gcc/fold-const.cc:10893
#12 0x0000000000c3b8fe in fold_build2_loc (loc=loc@entry=2147516709, 
    code=code@entry=GT_EXPR, type=type@entry=0x7ffff752a5e8, 
    op0=op0@entry=0x7ffff5a65900, op1=0x7ffff72fb288)
    at /home/rearnsha/gnusrc/gcc-cross/master/gcc/fold-const.cc:13845
#13 0x00000000016a0eff in generic_simplify_22 (loc=2147516709, 
    type=0x7ffff752a5e8, captures=0x7ffffffe8140, cmp=GT_EXPR, 
    _p1=<optimized out>, _p0=<optimized out>) at generic-match.cc:2445
#14 0x0000000001700472 in generic_simplify_GT_EXPR (loc=2147516709, 
    type=0x7ffff752a5e8, _p0=0x7ffff5a65930, _p1=0x7ffff72fb288, 
    code=<optimized out>) at generic-match.cc:75812

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

* [Bug middle-end/106642] cc1 compiler hangs when cross-compiling ring_buffer.c (from kernel/events) on Aarch64
  2022-08-16 13:29 [Bug c/106642] New: cc1 compiler hangs when cross-compiling ring_buffer.c (from kernel/events) on Aarch64 pivanov at hotmail dot com
  2022-08-16 13:31 ` [Bug c/106642] " pivanov at hotmail dot com
  2022-08-16 13:56 ` [Bug middle-end/106642] " rearnsha at gcc dot gnu.org
@ 2022-08-16 14:00 ` pinskia at gcc dot gnu.org
  2022-08-16 14:09 ` pivanov at hotmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-16 14:00 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |106617

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I am 99% sure this is a duplicate of bug 106617


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106617
[Bug 106617] [13 Regression] gcc is very slow at ternary expressions since
r13-322-g7f04b0d786e13ff5

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

* [Bug middle-end/106642] cc1 compiler hangs when cross-compiling ring_buffer.c (from kernel/events) on Aarch64
  2022-08-16 13:29 [Bug c/106642] New: cc1 compiler hangs when cross-compiling ring_buffer.c (from kernel/events) on Aarch64 pivanov at hotmail dot com
                   ` (2 preceding siblings ...)
  2022-08-16 14:00 ` pinskia at gcc dot gnu.org
@ 2022-08-16 14:09 ` pivanov at hotmail dot com
  2022-08-16 14:46 ` pinskia at gcc dot gnu.org
  2022-08-16 14:48 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pivanov at hotmail dot com @ 2022-08-16 14:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from pivanov at hotmail dot com ---
It really looks like endless recursion as the whole memory gets exhausted if I
leave it running long enough.

What I see in bug 106617 description
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106617) is that it just works
slowly but gets the work done.

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

* [Bug middle-end/106642] cc1 compiler hangs when cross-compiling ring_buffer.c (from kernel/events) on Aarch64
  2022-08-16 13:29 [Bug c/106642] New: cc1 compiler hangs when cross-compiling ring_buffer.c (from kernel/events) on Aarch64 pivanov at hotmail dot com
                   ` (3 preceding siblings ...)
  2022-08-16 14:09 ` pivanov at hotmail dot com
@ 2022-08-16 14:46 ` pinskia at gcc dot gnu.org
  2022-08-16 14:48 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-16 14:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---

  max_order = ( __builtin_constant_p(nr_pages) ? (
__builtin_constant_p(nr_pages) ? ( (nr_pages) < 2 ? 0 : (nr_pages) & (1ULL <<
63) ? 63 : (nr_pages) & (1ULL << 62) ? 62 : (nr_pages) & (1ULL << 61) ? 61 :
(nr_pages) & (1ULL << 60) ? 60 : (nr_pages) & (1ULL << 59) ? 59 : (nr_pages) &
(1ULL << 58) ? 58 : (nr_pages) & (1ULL << 57) ? 57 : (nr_pages) & (1ULL << 56)
? 56 : (nr_pages) & (1ULL << 55) ? 55 : (nr_pages) & (1ULL << 54) ? 54 :
(nr_pages) & (1ULL << 53) ? 53 : (nr_pages) & (1ULL << 52) ? 52 : (nr_pages) &
(1ULL << 51) ? 51 : (nr_pages) & (1ULL << 50) ? 50 : (nr_pages) & (1ULL << 49)
? 49 : (nr_pages) & (1ULL << 48) ? 48 : (nr_pages) & (1ULL << 47) ? 47 :
(nr_pages) & (1ULL << 46) ? 46 : (nr_pages) & (1ULL << 45) ? 45 : (nr_pages) &
(1ULL << 44) ? 44 : (nr_pages) & (1ULL << 43) ? 43 : (nr_pages) & (1ULL << 42)
? 42 : (nr_pages) & (1ULL << 41) ? 41 : (nr_pages) & (1ULL << 40) ? 40 :
(nr_pages) & (1ULL << 39) ? 39 : (nr_pages) & (1ULL << 38) ? 38 : (nr_pages) &
(1ULL << 37) ? 37 : (nr_pages) & (1ULL << 36) ? 36 : (nr_pages) & (1ULL << 35)
? 35 : (nr_pages) & (1ULL << 34) ? 34 : (nr_pages) & (1ULL << 33) ? 33 :
(nr_pages) & (1ULL << 32) ? 32 : (nr_pages) & (1ULL << 31) ? 31 : (nr_pages) &
(1ULL << 30) ? 30 : (nr_pages) & (1ULL << 29) ? 29 : (nr_pages) & (1ULL << 28)
? 28 : (nr_pages) & (1ULL << 27) ? 27 : (nr_pages) & (1ULL << 26) ? 26 :
(nr_pages) & (1ULL << 25) ? 25 : (nr_pages) & (1ULL << 24) ? 24 : (nr_pages) &
(1ULL << 23) ? 23 : (nr_pages) & (1ULL << 22) ? 22 : (nr_pages) & (1ULL << 21)
? 21 : (nr_pages) & (1ULL << 20) ? 20 : (nr_pages) & (1ULL << 19) ? 19 :
(nr_pages) & (1ULL << 18) ? 18 : (nr_pages) & (1ULL << 17) ? 17 : (nr_pages) &
(1ULL << 16) ? 16 : (nr_pages) & (1ULL << 15) ? 15 : (nr_pages) & (1ULL << 14)
? 14 : (nr_pages) & (1ULL << 13) ? 13 : (nr_pages) & (1ULL << 12) ? 12 :
(nr_pages) & (1ULL << 11) ? 11 : (nr_pages) & (1ULL << 10) ? 10 : (nr_pages) &
(1ULL << 9) ? 9 : (nr_pages) & (1ULL << 8) ? 8 : (nr_pages) & (1ULL << 7) ? 7 :
(nr_pages) & (1ULL << 6) ? 6 : (nr_pages) & (1ULL << 5) ? 5 : (nr_pages) &
(1ULL << 4) ? 4 : (nr_pages) & (1ULL << 3) ? 3 : (nr_pages) & (1ULL << 2) ? 2 :
1) : -1) : (sizeof(nr_pages) <= 4) ? __ilog2_u32(nr_pages) :
__ilog2_u64(nr_pages) );

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

* [Bug middle-end/106642] cc1 compiler hangs when cross-compiling ring_buffer.c (from kernel/events) on Aarch64
  2022-08-16 13:29 [Bug c/106642] New: cc1 compiler hangs when cross-compiling ring_buffer.c (from kernel/events) on Aarch64 pivanov at hotmail dot com
                   ` (4 preceding siblings ...)
  2022-08-16 14:46 ` pinskia at gcc dot gnu.org
@ 2022-08-16 14:48 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-16 14:48 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Yes it is a dup of bug 106617.

> It really looks like endless recursion as the whole memory gets exhausted if I leave it running long enough.

That is because the original testcase is reduced further to figure out what is
going on. But it is the same

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

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

end of thread, other threads:[~2022-08-16 14:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-16 13:29 [Bug c/106642] New: cc1 compiler hangs when cross-compiling ring_buffer.c (from kernel/events) on Aarch64 pivanov at hotmail dot com
2022-08-16 13:31 ` [Bug c/106642] " pivanov at hotmail dot com
2022-08-16 13:56 ` [Bug middle-end/106642] " rearnsha at gcc dot gnu.org
2022-08-16 14:00 ` pinskia at gcc dot gnu.org
2022-08-16 14:09 ` pivanov at hotmail dot com
2022-08-16 14:46 ` pinskia at gcc dot gnu.org
2022-08-16 14:48 ` pinskia 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).