Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

about 2 years ago

Language

C++

Compiler

gcc 12.2.0

Options
Warnings
Don't Use Boost
Compiler Default
-pedantic

Author

anonymous

about 2 years ago

$ g++ prog.cc -Wall -Wextra -pedantic
prog.cc: In function 'int main()':
prog.cc:8:14: warning: format '%p' expects argument of type 'void*', but argument 2 has type 'char (*)[6]' [-Wformat=]
    8 |     printf("%p\n", a);
      |             ~^     ~
      |              |     |
      |              void* char (*)[6]
prog.cc:10:14: warning: format '%p' expects argument of type 'void*', but argument 2 has type 'int' [-Wformat=]
   10 |     printf("%p\n", **a);
      |             ~^     ~~~
      |              |     |
      |              void* int
      |             %d
prog.cc:13:11: warning: 'int __builtin_puts(const char*)' reading 1 or more bytes from a region of size 0 [-Wstringop-overread]
   13 |     printf("%s\n", a[1]); // uninitialized
      |     ~~~~~~^~~~~~~~~~~~~~
prog.cc:5:10: note: at offset 6 into source object 'str' of size 6
    5 |     char str[6] = "hello";
      |          ^~~
0x7ffea1d2beb2
0x7ffea1d2beb2
0x68
hello
��ҡ�
Exit Code:
0