How can distinguish DECL in LTO mode?
Hello, everyone. Sorry to disturb you, but this question confused me several days, I have searched the GCC source code cannot find the answers. I know we can distinguish the different DECL tree using DECL_UID in a translation unit. But when in LTO mode, lto1 combine some input fat object files. How can I distinguish the different DECL tree may come from two different object files? Thanks.
a question about structure convert to char* in function printf/fprintf
Hi all, As we know, gcc would give us an error message when we do this: `struct _test a; char *s = a;`; However, when we use this in printf/fprintf, it gets wired. ```c #include struct _test { char name[256]; }; struct _test tests[100]; int main(int argc, char *argv[]) { memcpy(tests[0].name, "hello0", 6); memcpy(tests[1].name, "hello1", 6); memcpy(tests[2].name, "hello2", 6); for (int i = 0; i < 3; i++) { #if 1 /* output hello1 */ printf("%s\n", tests[i]); /* output looks to be all right */ printf("%d %s\n", i, tests[i]); printf("%d %d %s\n", i, i, tests[i]); #else printf("%s\n", tests[i], "hello gcc"); #endif } return 0; } ``` Gcc just give a warning message, and copy the structure to stack, some registers will be reset(%rsi...), then ignore the argument `tests[i]`, which means `#else` will output `hello gcc`. Should gcc give it an error to prevent a structure from converting to char* in functions printf/fprintf? Best regards,
Re: How can distinguish DECL in LTO mode?
On August 12, 2018 12:30:26 PM GMT+02:00, zet wrote: >Hello, everyone. >Sorry to disturb you, but this question confused me several days, I >have >searched the GCC source code cannot find the answers. > >I know we can distinguish the different DECL tree using DECL_UID in a >translation unit. But when in LTO mode, lto1 combine some input fat >object >files. How can I distinguish the different DECL tree may come from >two different object files? Decl_uid is re-assigned during LTO streaming and thus still unique. Richard. > >Thanks.
Re: a question about structure convert to char* in function printf/fprintf
On Sun, 12 Aug 2018 at 15:59, zerons wrote: > Should gcc give it an error to prevent a structure from converting to > char* in functions printf/fprintf? Your question is inappropriate on this mailing list, please use gcc-help next time. See https://gcc.gnu.org/lists.html Did you try compiling with warnings? If not, why not. -Werror=format will give you an error.
Error from dwarf2cfi.c in gcc vers 7.2.0
All: I've been hacking with version 7.2.0 of gcc trying to adapt some old md files that I've got to this newer gcc. I've been getting errors from the dwarf2out_frame_debug_expr() function in dwarf2cfi.c line 1790 calling gcc_unreachable(). The expression being processed is a SET. The src operand is a MEM reference and the dest operand is a REG reference. If I run the compiler with the option -fno-asynchronous-unwind-tables I do NOT get the error and the generated code looks reasonable. So, my questions are: 1. Have others seen this kind of problem? 2. If so, what did you do to fix it problem? 3. Do you need more information? I just can't seem to see what I'm doing wrong Thanks in advance. -- Dave Pitts PULLMAN: Travel and sleep in safety and comfort. dpi...@cozx.com
gcc-9-20180812 is now available
Snapshot gcc-9-20180812 is now available on ftp://gcc.gnu.org/pub/gcc/snapshots/9-20180812/ and on various mirrors, see http://gcc.gnu.org/mirrors.html for details. This snapshot has been generated from the GCC 9 SVN branch with the following options: svn://gcc.gnu.org/svn/gcc/trunk revision 263499 You'll find: gcc-9-20180812.tar.xzComplete GCC SHA256=958e909ccbf364841420c4d2a4c920f4b27c9d9619a53353a5b76ababb606877 SHA1=66cba5ff05d5af0125f6d41a001bf6e670175ca4 Diffs from 9-20180805 are available in the diffs/ subdirectory. When a particular snapshot is ready for public consumption the LATEST-9 link is updated and a message is sent to the gcc list. Please do not use a snapshot before it has been announced that way.
Re: a question about structure convert to char* in function printf/fprintf
On 08/13/2018 03:13 AM, Jonathan Wakely wrote: On Sun, 12 Aug 2018 at 15:59, zerons wrote: Should gcc give it an error to prevent a structure from converting to char* in functions printf/fprintf? Your question is inappropriate on this mailing list, please use gcc-help next time. See https://gcc.gnu.org/lists.html I'm so sorry for that. Did you try compiling with warnings? If not, why not. -Werror=format will give you an error. Oh, I forget to use -Werror. I use -Wall a lot. :( Unfortunately I didn't try to solve all the warnings. Thanks.