This is the mail archive of the gcc-patches@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]

Re: [PATCH] treat -Wxxx-larger-than=HWI_MAX special (PR 86631)


On Wed, Jul 25, 2018 at 4:07 AM Martin Sebor <msebor@gmail.com> wrote:
>
> The very large option argument enhancement committed last week
> inadvertently introduced an assumption about the LP64 data model
> that makes the -Wxxx-larger-than options have a different effect
> at their default documented setting of PTRDIFF_MAX between ILP32
> and LP64.  As a result, the options are treated as suppressed in
> ILP32 while triggering the expected warnings for allocations or
> sizes in excess of the limit in ILP64.
>
> To remove this I considered making it possible to use symbolic
> constants like PTRDIFF_MAX as the option arguments so that
> then defaults in the .opt files could be set to that.  Sadly,
> options in GCC are processed before the values of constants
> like PTRDIFF_MAX for the target are known, and deferring
> the handling of just the -Wxxx-larger-than= options until
> the constants have been computed would be too involved to
> make it worth the effort.
>
> To keep things simple I decided to have the code that handles
> each of the affected options treat the HOST_WIDE_INT_MAX default
> as a special request to substitute the value of PTRDIFF_MAX at
> the time.
>
> The attached patch implements this.

I wonder if documenting a special value of -1 would be easier for
users to use.  Your patch doesn't come with adjustments to
invoke.texi so I wonder how people could know of this special
handling?

Richard.

> Tested on x86_64-linux with -m32/-m64.
>
> Martin


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