new: argument 1 value '18446744073709551599' exceeds maximum

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
AndrewAPrice
Member
Member
Posts: 2300
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

new: argument 1 value '18446744073709551599' exceeds maximum

Post by AndrewAPrice »

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: Select all

../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?
Last edited by AndrewAPrice on Thu Sep 29, 2022 9:16 pm, edited 1 time in total.
My OS is Perception.
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: new: argument 1 value '18446744073709551599' exceeds max

Post by Octocontrabass »

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.
User avatar
AndrewAPrice
Member
Member
Posts: 2300
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: new: argument 1 value '18446744073709551599' exceeds max

Post by AndrewAPrice »

You're right, I'm using GCC 12.2.0.
My OS is Perception.
Post Reply