Clang warning for invalid casting!

I am trying to compile a simple code (see below) with gcc and clang. the gcc generates a warning indicating an incomparable casting (great!). However, clang didn’t generate any warnings! I have passed the same arguments for both:

<kbd>cc -Wall -Wextra tmp3.c</kbd>
<kbd>gcc -Wall -Wextra tmp3.c</kbd>

Should I expect clang to generate error or not? If yes, is there an additional option needs to be passed to clang compiler to generate a warning for something that is obviously wrong?

Code:

int main(void)
{
   void *b = (void *)0x12345678;
   int   a = (int)(unsigned long)b;
   int   c = (int)b;
   return a + c;
}

Clang version 3.8

Clang 3.8 gives an error as expected, so the problem is probably in
your setup. See Compiler Explorer

- Raphael

Clang 3.8 gives an error as expected, so the problem is probably in
your setup. See Compiler Explorer

To add to that, it only warns if -m64 is specified, and does not warn
if -m32 is specified. Similarly, here on 64-bit machine, it does not warn.

- Raphael

Roman.

Clang 3.8 gives an error as expected, so the problem is probably in
your setup. See Compiler Explorer

To add to that, it only warns if -m64 is specified, and does not warn
if -m32 is specified. Similarly, here on 64-bit machine, it does not warn.

Edit: also, the original author asked about C, and not C++.
And if -x c is specified, there is no warning no matter the -m32/-m64

Oh true, I stand corrected.

- Raphael

So is there an answer for this inquiry or not?

Thank you!