#1214: inttypes.h's PRI*PTR uses %*ll where it should use %*l ----------------------------+----------------------------- Reporter: ralf.corsepius | Owner: ralf.corsepius Type: defect | Status: new Priority: normal | Milestone: 4.9.5 Component: Newlib | Version: unspecified Severity: normal | Resolution: Keywords: | ----------------------------+----------------------------- Changes (by gedare):
* milestone: 2 => 4.9.5 Old description: > newlib-1.15.0's inttypes.h's implementation of the > PRI*PTR macros is broken. > > The %*l macro being chosen doesn't correspond to the type being used as > intptr_t. > > To reproduce, compile this: > > cat tmp.c > #include <stdio.h> > #include <inttypes.h> > > int main() > { > void *null = 0; > printf( "%" PRIxPTR "\n", (intptr_t) null ); > return 0; > } > > # for c in /opt/rtems-4.8/bin/*-rtems4.8-gcc; do \ > echo "$c:"; $c -o tmp.o -Wall -c tmp.c; done > > /opt/rtems-4.8/bin/arm-rtems4.8-gcc: > tmp.c: In function 'main': > tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', > but argument 2 has type 'long int' > > /opt/rtems-4.8/bin/avr-rtems4.8-gcc: > tmp.c: In function 'main': > tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', > but argument 2 has type 'int' > > /opt/rtems-4.8/bin/bfin-rtems4.8-gcc: > tmp.c: In function 'main': > tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', > but argument 2 has type 'long int' > > /opt/rtems-4.8/bin/h8300-rtems4.8-gcc: > tmp.c: In function 'main': > tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', > but argument 2 has type 'int' > > /opt/rtems-4.8/bin/i386-rtems4.8-gcc: > tmp.c: In function 'main': > tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', > but argument 2 has type 'long int' > > /opt/rtems-4.8/bin/m68k-rtems4.8-gcc: > tmp.c: In function 'main': > tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', > but argument 2 has type 'long int' > > /opt/rtems-4.8/bin/mips-rtems4.8-gcc: > tmp.c: In function 'main': > tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', > but argument 2 has type 'int' > > /opt/rtems-4.8/bin/powerpc-rtems4.8-gcc: > tmp.c: In function 'main': > tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', > but argument 2 has type 'int' > > /opt/rtems-4.8/bin/sparc-rtems4.8-gcc: > tmp.c: In function 'main': > tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', > but argument 2 has type 'int' > > /opt/rtems-4.8/bin/tic4x-rtems4.8-gcc: > tmp.c: In function `main': > tmp.c:7: warning: long long unsigned int format, different type arg (arg > 2) > > Affected are all targets on all rtems branches. New description: newlib-1.15.0's inttypes.h's implementation of the PRI*PTR macros is broken. The %*l macro being chosen doesn't correspond to the type being used as intptr_t. To reproduce, compile this: > cat tmp.c #include <stdio.h> #include <inttypes.h> int main() { void *null = 0; printf( "%" PRIxPTR "\n", (intptr_t) null ); return 0; } # for c in /opt/rtems-4.8/bin/*-rtems4.8-gcc; do \ echo "$c:"; $c -o tmp.o -Wall -c tmp.c; done /opt/rtems-4.8/bin/arm-rtems4.8-gcc: tmp.c: In function 'main': tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', but argument 2 has type 'long int' /opt/rtems-4.8/bin/avr-rtems4.8-gcc: tmp.c: In function 'main': tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', but argument 2 has type 'int' /opt/rtems-4.8/bin/bfin-rtems4.8-gcc: tmp.c: In function 'main': tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', but argument 2 has type 'long int' /opt/rtems-4.8/bin/h8300-rtems4.8-gcc: tmp.c: In function 'main': tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', but argument 2 has type 'int' /opt/rtems-4.8/bin/i386-rtems4.8-gcc: tmp.c: In function 'main': tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', but argument 2 has type 'long int' /opt/rtems-4.8/bin/m68k-rtems4.8-gcc: tmp.c: In function 'main': tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', but argument 2 has type 'long int' /opt/rtems-4.8/bin/mips-rtems4.8-gcc: tmp.c: In function 'main': tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', but argument 2 has type 'int' /opt/rtems-4.8/bin/powerpc-rtems4.8-gcc: tmp.c: In function 'main': tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', but argument 2 has type 'int' /opt/rtems-4.8/bin/sparc-rtems4.8-gcc: tmp.c: In function 'main': tmp.c:7: warning: format '%llx' expects type 'long long unsigned int', but argument 2 has type 'int' /opt/rtems-4.8/bin/tic4x-rtems4.8-gcc: tmp.c: In function `main': tmp.c:7: warning: long long unsigned int format, different type arg (arg 2) Affected are all targets on all rtems branches. -- -- Ticket URL: <http://devel.rtems.org/ticket/1214#comment:2> RTEMS Project <http://www.rtems.org/> RTEMS Project _______________________________________________ bugs mailing list bugs@rtems.org http://lists.rtems.org/mailman/listinfo/bugs