OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 5:10 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: new: argument 1 value '18446744073709551599' exceeds maximum
PostPosted: Thu Sep 29, 2022 2:41 pm 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
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?

_________________
My OS is Perception.


Last edited by AndrewAPrice on Thu Sep 29, 2022 9:16 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: new: argument 1 value '18446744073709551599' exceeds max
PostPosted: Thu Sep 29, 2022 5:24 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
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.


Top
 Profile  
 
 Post subject: Re: new: argument 1 value '18446744073709551599' exceeds max
PostPosted: Thu Sep 29, 2022 9:16 pm 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
You're right, I'm using GCC 12.2.0.

_________________
My OS is Perception.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 73 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group