public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "lluis.alemany.puig at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106409] New: GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size Date: Fri, 22 Jul 2022 11:12:12 +0000 [thread overview] Message-ID: <bug-106409-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106409 Bug ID: 106409 Summary: GCC with LTO: Warning: argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size Product: gcc Version: 11.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lluis.alemany.puig at gmail dot com Target Milestone: --- I'm using g++ (Ubuntu 11.1.0-1ubuntu1~20.04) 11.1.0. I'm getting the following warning when I compile my code using -flto and -fno-fat-lto-objects: ``` In member function ‘alloc_data’, inlined from ‘__ct ’ at data_array.hpp:9:67, inlined from ‘__ct ’ at main.cpp:26:5, inlined from ‘main’ at main.cpp:61:16: data_array.hpp:29:50: warning: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=] 29 | m_data = m_size == 0 ? nullptr : new T[m_size]; | ^ data_array.hpp: In function ‘main’: /usr/include/c++/11/new:128:26: note: in a call to allocation function ‘operator new []’ declared here 128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^ ``` The two sets of commands I use to compile my code are (-fsanitize=undefined): ``` g++ -pipe -std=c++17 -fPIC -fopenmp -flto -fno-fat-lto-objects -O3 -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast -Wrestrict -UDEBUG -DNDEBUG -fstrict-aliasing -D_REENTRANT -fPIC -fsanitize=undefined -c main.cpp g++ -fPIC -O3 -flto -fno-fat-lto-objects -DNDEBUG -UDEBUG -Wl,-O3 -fsanitize=undefined -o main main.o ``` and (-fsanitize=address) ``` g++ -pipe -std=c++17 -fPIC -fopenmp -flto -fno-fat-lto-objects -O3 -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast -Wrestrict -UDEBUG -DNDEBUG -fstrict-aliasing -D_REENTRANT -fPIC -fsanitize=address -c main.cpp g++ -fPIC -O3 -flto -fno-fat-lto-objects -DNDEBUG -UDEBUG -Wl,-O3 -o main main.o -lasan ``` Both sets of commands produce the warning above. With both, the program executes normally and finishes without issuing any error message. I generated the *i file with the following command ``` g++ -E -std=c++17 -fPIC -fopenmp -flto -fno-fat-lto-objects -O3 -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast -Wrestrict -UDEBUG -DNDEBUG -fstrict-aliasing -D_REENTRANT -fPIC -save-temps -c main.cpp ```
next reply other threads:[~2022-07-22 11:12 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-22 11:12 lluis.alemany.puig at gmail dot com [this message] 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 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 2023-05-17 18:47 ` pinskia at gcc dot gnu.org 2023-05-17 18:58 ` thiago at kde dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-106409-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).