This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug target/69226] New: Wrong __SIZE_TYPE__/__PTRDIFF_TYPE__/__WCHAR_TYPE__ for IA MCU


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69226

            Bug ID: 69226
           Summary: Wrong __SIZE_TYPE__/__PTRDIFF_TYPE__/__WCHAR_TYPE__
                    for IA MCU
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: vaalfreja at gmail dot com
  Target Milestone: ---

[hjl@gnu-tools-1 gcc]$ cat /tmp/y.c
typedef __SIZE_TYPE__ size_t;
typedef __PTRDIFF_TYPE__ ptrdiff_t;
typedef __WCHAR_TYPE__ wchar_t;

void
foo (size_t a, ptrdiff_t b, wchar_t c)
{
  __builtin_printf ("%d 0x%x, %ld\n", a, b, c);
}
[hjl@gnu-tools-1 gcc]$  ./xgcc -B./ -S -Wall /tmp/y.c 
/tmp/y.c: In function âfooâ:
/tmp/y.c:8:23: warning: format â%dâ expects argument of type âintâ, but
argument 2 has type âsize_t {aka long unsigned int}â [-Wformat=]
   __builtin_printf ("%d 0x%x, %ld\n", a, b, c);
                       ^

/tmp/y.c:8:28: warning: format â%xâ expects argument of type âunsigned intâ,
but argument 3 has type âptrdiff_t {aka long int}â [-Wformat=]
   __builtin_printf ("%d 0x%x, %ld\n", a, b, c);
                            ^

/tmp/y.c:8:33: warning: format â%ldâ expects argument of type âlong intâ, but
argument 4 has type âwchar_t {aka int}â [-Wformat=]
   __builtin_printf ("%d 0x%x, %ld\n", a, b, c);
                                 ^

[hjl@gnu-tools-1 gcc]$  gcc  -S -Wall /tmp/y.c  -m32
[hjl@gnu-tools-1 gcc]$

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