* [Bug c++/106409] GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size
2022-07-22 11:12 [Bug c++/106409] New: GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size lluis.alemany.puig at gmail dot com
@ 2022-07-22 11:13 ` lluis.alemany.puig at gmail dot com
2022-07-22 11:25 ` marxin at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: lluis.alemany.puig at gmail dot com @ 2022-07-22 11:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106409
--- Comment #1 from llualpu <lluis.alemany.puig at gmail dot com> ---
This was originally submitted at Stack Overflow:
https://stackoverflow.com/questions/73047957/gcc-with-lto-warning-argument-1-value-18-615-size-max-exceeds-maximum-ob
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/106409] GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size
2022-07-22 11:12 [Bug c++/106409] New: GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size lluis.alemany.puig at gmail dot com
2022-07-22 11:13 ` [Bug c++/106409] " lluis.alemany.puig at gmail dot com
@ 2022-07-22 11:25 ` marxin at gcc dot gnu.org
2022-07-22 12:03 ` lluis.alemany.puig at gmail dot com
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-07-22 11:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106409
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |WAITING
CC| |marxin at gcc dot gnu.org
Last reconfirmed| |2022-07-22
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Please attach the pre-processed source file.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/106409] GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size
2022-07-22 11:12 [Bug c++/106409] New: GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size lluis.alemany.puig at gmail dot com
2022-07-22 11:13 ` [Bug c++/106409] " lluis.alemany.puig at gmail dot com
2022-07-22 11:25 ` marxin at gcc dot gnu.org
@ 2022-07-22 12:03 ` lluis.alemany.puig at gmail dot com
2022-07-25 18:29 ` [Bug tree-optimization/106409] " pinskia at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: lluis.alemany.puig at gmail dot com @ 2022-07-22 12:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106409
--- Comment #3 from llualpu <lluis.alemany.puig at gmail dot com> ---
Created attachment 53336
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53336&action=edit
(Compressed) preprocessed file generated by GCC as required by "What we need"
I couldn't upload it raw (in plain text, without compressing) because it was
bigger than the file size limit (around 1300 KB).
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/106409] GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size
2022-07-22 11:12 [Bug c++/106409] New: GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size lluis.alemany.puig at gmail dot com
` (2 preceding siblings ...)
2022-07-22 12:03 ` lluis.alemany.puig at gmail dot com
@ 2022-07-25 18:29 ` pinskia at gcc dot gnu.org
2023-05-17 18:21 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-07-25 18:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106409
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|1 |0
Status|WAITING |UNCONFIRMED
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/106409] GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size
2022-07-22 11:12 [Bug c++/106409] New: GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size lluis.alemany.puig at gmail dot com
` (3 preceding siblings ...)
2022-07-25 18:29 ` [Bug tree-optimization/106409] " pinskia at gcc dot gnu.org
@ 2023-05-17 18:21 ` pinskia at gcc dot gnu.org
2023-05-17 18:22 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-17 18:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106409
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=80922
Ever confirmed|0 |1
Keywords| |lto
Last reconfirmed|2022-07-22 00:00:00 |2023-05-17
Status|UNCONFIRMED |NEW
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect the issue is for LTO we don't stream out the ignore part .
Anyways confirmed, you can reproduce it with the following single file
testcase:
```
typedef struct st_mysql_bind
{
int t;
int t1;
int t2;
int t3;
} bb;
[[gnu::noipa]]
void *f(unsigned long paramCount)
{
if (paramCount == 0)
return nullptr;
return new bb[paramCount]();
}
int main(void)
{
f(100);
}
```
Compile it with `-flto -W -Wall -O2` and see the warning.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/106409] GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size
2022-07-22 11:12 [Bug c++/106409] New: GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size lluis.alemany.puig at gmail dot com
` (4 preceding siblings ...)
2023-05-17 18:21 ` pinskia at gcc dot gnu.org
@ 2023-05-17 18:22 ` pinskia at gcc dot gnu.org
2023-05-17 18:38 ` [Bug tree-optimization/106409] GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size with new thiago at kde dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-17 18:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106409
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |thiago at kde dot org
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 109895 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/106409] GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size with new
2022-07-22 11:12 [Bug c++/106409] New: GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size lluis.alemany.puig at gmail dot com
` (5 preceding siblings ...)
2023-05-17 18:22 ` pinskia at gcc dot gnu.org
@ 2023-05-17 18:38 ` thiago at kde dot org
2023-05-17 18:47 ` pinskia at gcc dot gnu.org
2023-05-17 18:58 ` thiago at kde dot org
8 siblings, 0 replies; 10+ messages in thread
From: thiago at kde dot org @ 2023-05-17 18:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106409
--- Comment #6 from Thiago Macieira <thiago at kde dot org> ---
Suggestion: add a function to libgcc to be called instead of
__cxa_throw_bad_array_new_length when exceptions are disabled. That function
can be a mere two instructions, but it provides two advantages:
* no need to stream something into LTO
* allows post-compilation tools to know what's happened (Valgrind, debuggers,
etc.)
I don't know if this is an acceptable solution, but I thought I'd make the
suggestion.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/106409] GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size with new
2022-07-22 11:12 [Bug c++/106409] New: GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size lluis.alemany.puig at gmail dot com
` (6 preceding siblings ...)
2023-05-17 18:38 ` [Bug tree-optimization/106409] GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size with new thiago at kde dot org
@ 2023-05-17 18:47 ` pinskia at gcc dot gnu.org
2023-05-17 18:58 ` thiago at kde dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-17 18:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106409
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=58525
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Thiago Macieira from comment #6)
> Suggestion: add a function to libgcc to be called instead of
> __cxa_throw_bad_array_new_length when exceptions are disabled. That function
> can be a mere two instructions, but it provides two advantages:
> * no need to stream something into LTO
Except there is still a generic issue (which I did link, PR 80922).
> * allows post-compilation tools to know what's happened (Valgrind,
> debuggers, etc.)
>
> I don't know if this is an acceptable solution, but I thought I'd make the
> suggestion.
See PR 58525 also which added that code path.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/106409] GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size with new
2022-07-22 11:12 [Bug c++/106409] New: GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size lluis.alemany.puig at gmail dot com
` (7 preceding siblings ...)
2023-05-17 18:47 ` pinskia at gcc dot gnu.org
@ 2023-05-17 18:58 ` thiago at kde dot org
8 siblings, 0 replies; 10+ messages in thread
From: thiago at kde dot org @ 2023-05-17 18:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106409
--- Comment #8 from Thiago Macieira <thiago at kde dot org> ---
(In reply to Andrew Pinski from comment #7)
> See PR 58525 also which added that code path.
That explains why it won't call __cxa_throw_bad_array_new_length, but not why
it will call operator new[](-1). My suggestion is to keep
__cxa_throw_bad_array_new_length for the exceptions case and add a new function
for the non-exceptional case. This function could:
* call operator new[], which would probably cause the stack unwinder to
terminate the application
* call std::terminate() directly, possibly after printing something to stderr
* return null pointer
* something else (generate debug break, raise(SIGKILL), etc.)
^ permalink raw reply [flat|nested] 10+ messages in thread