This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: Bootstrap failure because of warning in tc-i386.c


On Fri, Dec 18, 2015 at 12:57 AM, Nick Clifton <nickc@redhat.com> wrote:
> Hi H,J.
>
>   I was trying to bootstrap the current mainline FSF gcc sources
>   yesterday, using a combined tree with the latest binutils sources,
>   when I ran into this error:
>
> gas/config/tc-i386.c: In function 'optimize_imm':
> gas/config/tc-i386.c:4222:53: error: result of '2l << 31' requires 34 bits to represent, but 'long int' only has 32 bits [-Werror=shift-overflow=]
>    && ((i.op[op].imms->X_add_number & ~(((offsetT) 2 << 31) - 1))
>                                                      ^~
>
> gas/config/tc-i386.c: In function 'optimize_disp':
> gas/config/tc-i386.c:4310:32: error: result of '2l << 31' requires 34 bits to represent, but 'long int' only has 32 bits [-Werror=shift-overflow=]
>    && (op_disp & ~(((offsetT) 2 << 31) - 1)) == 0)
>                                 ^~
>
> gas/config/tc-i386.c:4315:28: error: result of '2l << 31' requires 34 bits to represent, but 'long int' only has 32 bits [-Werror=shift-overflow=]
>    op_disp &= (((offsetT) 2 << 31) - 1);
>                             ^~
>
>   I tried adding a check on the size of offsetT but that was
>   insufficient - the compiler still complained even though the code
>   would never be executed.  So in the end I opted for the patch below -
>   which makes the code conditional on BFD64 being defined.  I am not
>   happy with the patch though, as it means that assembler will behave
>   differently depending upon whether it was built with 64-bit support
>   enabled or not.  Please could you take a look and decide if the patch
>   is OK, or if a better solution is needed.
>

Can you tell me how to reproduce it?  I will take care of it.

Thanks.

-- 
H.J.


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