OSDev.org
https://forum.osdev.org/

new: argument 1 value '18446744073709551599' exceeds maximum
https://forum.osdev.org/viewtopic.php?f=1&t=56507
Page 1 of 1

Author:  AndrewAPrice [ Thu Sep 29, 2022 2:41 pm ]
Post subject:  new: argument 1 value '18446744073709551599' exceeds maximum

When I compile user programs in my OS using gcc and libc++ and optimizations turned on, I get the following warning when I call 'new':
Code:
../Libraries/libcxx/public/new:248:24: warning: argument 1 value '18446744073709551599' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  248 |   return ::operator new(__args...);


It hasn't yet caused any noticble bugs, and I the warning doesn't appear when optimizations are disabled.

I'm curious why I'm getting this warning through.
18446744073709551599 = 0xFFFFFFFFFFFFFFEF Is something trying to allocate -16 bytes?

Author:  Octocontrabass [ Thu Sep 29, 2022 5:24 pm ]
Post subject:  Re: new: argument 1 value '18446744073709551599' exceeds max

AndrewAPrice wrote:
When I compile user programs in my OS using clang

Are you sure you're using Clang? That looks like a GCC warning.

AndrewAPrice wrote:
Is something trying to allocate -16 bytes?

The static analyzer seems to think so. There may be a problem in your bounds checking, or (if you're actually using GCC) you might have hit a false positive.

Author:  AndrewAPrice [ Thu Sep 29, 2022 9:16 pm ]
Post subject:  Re: new: argument 1 value '18446744073709551599' exceeds max

You're right, I'm using GCC 12.2.0.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/