public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] proposed fix for bug # 61144
@ 2014-05-21  1:59 Rich Felker
  2014-05-21  9:17 ` Richard Biener
  0 siblings, 1 reply; 17+ messages in thread
From: Rich Felker @ 2014-05-21  1:59 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 528 bytes --]

Bug # 61144 is a regression in 4.9.0 that breaks building of musl libc
due to aggressive and semantically-incorrect constant folding of weak
aliases. The attached patch seems to fix the issue. A weak alias
should never be a candidate for constant folding because it may always
be replaced by a strong definition from another translation unit.

For details see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61144

I do not have a copyright assignment on file but this patch should be
sufficiently trivial not to require it.

Rich

[-- Attachment #2: pr61144-v1.diff --]
[-- Type: text/plain, Size: 429 bytes --]

diff --git a/gcc/varpool.c b/gcc/varpool.c
index b426757..905047e 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -195,6 +195,8 @@ ctor_for_folding (tree decl)
     {
       gcc_assert (!DECL_INITIAL (decl)
 		  || DECL_INITIAL (decl) == error_mark_node);
+      if (DECL_WEAK (decl))
+        return error_mark_node;
       if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl)))
 	{
 	  node = varpool_alias_target (node);

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

end of thread, other threads:[~2014-07-23  9:00 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-21  1:59 [PATCH] proposed fix for bug # 61144 Rich Felker
2014-05-21  9:17 ` Richard Biener
2014-05-22  3:59   ` Rich Felker
2014-05-23 18:26     ` Jeff Law
2014-06-06 17:14       ` Rich Felker
2014-06-09 11:41         ` Alexander Monakov
2014-06-09 18:46           ` Rich Felker
2014-06-16  9:06             ` Jan Hubicka
2014-06-16 13:38               ` Rich Felker
2014-06-16 16:05                 ` Jan Hubicka
2014-06-16 16:35                   ` Rich Felker
2014-06-14 21:24           ` Rich Felker
2014-06-16  8:56     ` Jan Hubicka
2014-07-22 17:18       ` Alexander Monakov
2014-07-22 17:23         ` Alexander Monakov
2014-07-22 17:30           ` Rich Felker
2014-07-23  9:06           ` Florian Weimer

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).