Re: the same gcc binary emits warnings on one machine but not on another

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 20, 2016 at 7:53 PM, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote:
> On 20 October 2016 at 18:42, john smith wrote:
>> We use the same cross-compiler on two Linux machines: machine A and
>> machine B.  It produces some warnings on machine A but not on machine
>> B when used to compile the same file and with the same set of options
>> (specifically we use -Wall and -Wextra).  We are absolutely sure that
>> it's the same compiler - it's in the same version and has the same
>> md5sum on both machines.  However, these 2 Linux machines differ - A
>> is x32 Ubuntu, B is x64 bit Slackware.  I checked all environment
>
> Do you really mean x32, as in https://en.wikipedia.org/wiki/X32_ABI ?
> Or do you mean you mean x86 aka IA-32?

Sorry, I meant x86.

> Are both compilers producing 32-bit output? Both producing 64-bit
> output? One 32-bit and one 64-bit?
>
> That could make all the difference, compiling printf("%lu",
> sizeof(1)); will warn for i686 and not for x86_64, for example.

They both produce output for ARM 32-bit.  They are the same, and have
been configured the same by the vendor.

>> variables on both machines and didn't find anything suspicious - no
>> CFLAGS, CC or something related to compilation at all.  The compiler
>> in question behaves the same way when invoked from Makefile and when
>> invoked directly from the command line on both machines.
>>
>> Is this possible that due to some local differences in
>> libc/libgcc/whatnot GCC emits warnings on machine A but not on machine
>> B?
>
> Yes. Of course. If a header in /usr/include has a #warning in it on
> one machine and not in the other it's going to warn on one machine and
> not on the other. That's a silly example, but t here are loads of
> things that could cause it.

Since it's a cross-compiler do headers in /usr/include matter?

>>  What else can I check to learn what's the culprit here?
>
> All you've said is "I checked everything" and not told us anything useful.
>
> What's the warning? What does the code look like that triggers it?

The warnings are:

warning: control reaches end of non-void function [-Wreturn-type]

and:

warning: unused variable 'i' [-Wunused-variable]

The code is something like this (I cannot show the real code, sorry):

#include <stdio.h>
#include <stdlib.h>

int foo(void)
{}

int main(void)
{
  foo();

  int i = 10;

  return EXIT_SUCCESS;
}

-- 
<wempwer@xxxxxxxxx>



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux