tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] New warnings from mod


From: Christian Jullien
Subject: [Tinycc-devel] New warnings from mod
Date: Sat, 14 Dec 2019 18:37:19 +0100

Hello Grischka,

 

You last commit raises new warnings (at least on Aarch64):

tccrun.c:600:12: warning: assignment to ‘Elf64_Addr’ {aka ‘long unsigned int’} from ‘Elf64_Addr *’ {aka ‘long unsigned int *’} makes integer from pointer without a cast [-Wint-conversion]

  600 |     rc->fp = (addr_t *)uc->uc_mcontext.regs[29];

      |            ^

tccrun.c: In function ‘rt_get_caller_pc’:

tccrun.c:763:22: warning: initialization of ‘Elf64_Addr *’ {aka ‘long unsigned int *’} from ‘Elf64_Addr’ {aka ‘long unsigned int’} makes pointer from integer without a cast [-Wint-conversion]

  763 |         addr_t *fp = rc->fp;

      |                      ^~

 

And later:

 

----- libtest : tcc in threads -----

In file included from ../tcc.c:23:

In file included from ../libtcc.c:25:

../tccrun.c:600: warning: assignment makes integer from pointer without a cast

In file included from ../tcc.c:23:

In file included from ../libtcc.c:25:

../tccrun.c:763: warning: assignment makes pointer from integer without a cast

 

Otherwise:

    if (sizeof pc == 8)
        pc |= wanted_pc & 0xffffffff00000000ULL;

 

Is not portable because long long is not guaranteed to be 64bits and sizeof(pc) is not a compile time constant. A compiler tracking portability issues may protest on cste overflow.

 

Instead, if you decently assume that a long long is at least 32bits and you can probably use:

 

    if (sizeof pc == 8) {

        static const unsigned long long mask = ~0ULL ^ 0xFFFFFFFFULL;
        pc |= wanted_pc & mask;

    }

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]