This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug driver/81650] gcc -m32 mishandles -Walloc-size-larger-than=9223372036854775807


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 41893
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41893&action=edit
gcc8-pr81650.patch

There are multiple issues.  First on ilp32 host even specifying say 14EB will
mean multiply 14 by 0xffffffffa7640000ULL.  Another issue is that if you write
a bogus suffix, it will quietly use SSIZE_MAX.  Another issue is that overflow
in the computation is undetected.  And, the result of the multiplication is
then just cast to ssizetype.

Either we can treat the warning as warning if above MIN (SSIZE_MAX,
user_specified_value), this is implemented in this untested patch.
Or we could allow any values from 0 to SIZE_MAX (but then actually should
convert SSIZE_MAX to sizetype) and either treat values larger than SIZE_MAX as
infinity or SIZE_MAX, or diagnose any out of range values as errors.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]