public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99677] New: [[gnu::const]] attribute does not prevent dead global variable gets emitted.
@ 2021-03-20  3:24 unlvsur at live dot com
  2021-03-20  3:41 ` [Bug c++/99677] " unlvsur at live dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: unlvsur at live dot com @ 2021-03-20  3:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99677
           Summary: [[gnu::const]] attribute does not prevent dead global
                    variable gets emitted.
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: unlvsur at live dot com
  Target Milestone: ---

https://godbolt.org/z/Toncas

The code tries to import functions from DLLs in the global.

Clang does not generate the nt_create_file function pointer, GCC does. Even at
-O0, clang emits no code. It only emits code any function actually uses it.

That is super annoying for Windows since we have no way to invoke Windows NT
syscalls without emitting dead code with GCC.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-03-22  9:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-20  3:24 [Bug c++/99677] New: [[gnu::const]] attribute does not prevent dead global variable gets emitted unlvsur at live dot com
2021-03-20  3:41 ` [Bug c++/99677] " unlvsur at live dot com
2021-03-20  3:46 ` unlvsur at live dot com
2021-03-20  3:53 ` pinskia at gcc dot gnu.org
2021-03-20  6:13 ` unlvsur at live dot com
2021-03-22  8:57 ` rguenth at gcc dot gnu.org
2021-03-22  9:06 ` unlvsur at live dot com
2021-03-22  9:10 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).