public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111104] New: Fatal error: can't fill 256 bytes in section .rodata
@ 2023-08-22 20:46 adavanian at nvidia dot com
  2023-08-22 20:48 ` [Bug target/111104] " pinskia at gcc dot gnu.org
  2023-08-22 20:52 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: adavanian at nvidia dot com @ 2023-08-22 20:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111104
           Summary: Fatal error: can't fill 256 bytes in section .rodata
           Product: gcc
           Version: 12.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: adavanian at nvidia dot com
  Target Milestone: ---

Created attachment 55777
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55777&action=edit
The preprocessed file that triggers the bug

Compiling the following file results in a fatal error:

$gcc-12 -v

Using built-in specs.
COLLECT_GCC=gcc-12
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/12/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: "..."
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.3.0 (Ubuntu 12.3.0-1ubuntu1~22.04)

$cat test.cpp

struct A {
  int i;
  constexpr A() : i(0) {}
};
struct B {
  A a[1125488619006459660];
};
extern const B b{};

$gcc-12 test.cpp -o test.bin

/tmp/cc4H9Jsi.s: Assembler messages:
/tmp/cc4H9Jsi.s: Fatal error: can't fill 256 bytes in section .rodata of
/tmp/cc9wAeg1.o: 'file truncated'
/tmp/cc4H9Jsi.s: Fatal error: /tmp/cc9wAeg1.o: file truncated

Additional note: this test case is very similar to
testsuite\g++.dg\cpp0x\constexpr-array.C.

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

* [Bug target/111104] Fatal error: can't fill 256 bytes in section .rodata
  2023-08-22 20:46 [Bug c++/111104] New: Fatal error: can't fill 256 bytes in section .rodata adavanian at nvidia dot com
@ 2023-08-22 20:48 ` pinskia at gcc dot gnu.org
  2023-08-22 20:52 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-22 20:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I don't think there is anything GCC can do here. You requested a huge array
which is zero-filled and GCC is able to compile it to the produce assembly code
which is valid.

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

* [Bug target/111104] Fatal error: can't fill 256 bytes in section .rodata
  2023-08-22 20:46 [Bug c++/111104] New: Fatal error: can't fill 256 bytes in section .rodata adavanian at nvidia dot com
  2023-08-22 20:48 ` [Bug target/111104] " pinskia at gcc dot gnu.org
@ 2023-08-22 20:52 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-22 20:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Basically the assembler is trying to create an object file which contains
4501954476025838640 (or 4094503TB) in size (and that will fail at runtime when
you try to load the generated elf file.

There is nothing to be done here as GCC compiles this just fine and the
assembler is failing because well the array is huge and not placed in a section
which is zero-filed at runtime.

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

end of thread, other threads:[~2023-08-22 20:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-22 20:46 [Bug c++/111104] New: Fatal error: can't fill 256 bytes in section .rodata adavanian at nvidia dot com
2023-08-22 20:48 ` [Bug target/111104] " pinskia at gcc dot gnu.org
2023-08-22 20:52 ` 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).