Advertisement
Guest User

Untitled

a guest
May 10th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
  2. index 4f6761d..810ae4c 100644
  3. --- a/gcc/c/c-decl.c
  4. +++ b/gcc/c/c-decl.c
  5. @@ -2631,6 +2631,18 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
  6. else if (DECL_PRESERVE_P (newdecl))
  7. DECL_PRESERVE_P (olddecl) = 1;
  8.  
  9. + int decl_common = 0;
  10. + /* check for 'common' attribute (PR49551) */
  11. + if (TREE_CODE (olddecl) == VAR_DECL
  12. + && TREE_CODE (newdecl) == VAR_DECL)
  13. + {
  14. + if (lookup_attribute ("common", DECL_ATTRIBUTES (newdecl))
  15. + || lookup_attribute ("nocommon", DECL_ATTRIBUTES (newdecl)))
  16. + decl_common = DECL_COMMON (newdecl);
  17. + else
  18. + decl_common = DECL_COMMON (olddecl) && DECL_COMMON (newdecl);
  19. + }
  20. +
  21. /* Copy most of the decl-specific fields of NEWDECL into OLDDECL.
  22. But preserve OLDDECL's DECL_UID, DECL_CONTEXT and
  23. DECL_ARGUMENTS (if appropriate). */
  24. @@ -2694,6 +2706,8 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
  25. DECL_CONTEXT (olddecl) = olddecl_context;
  26. if (TREE_CODE (olddecl) == FUNCTION_DECL)
  27. DECL_ARGUMENTS (olddecl) = olddecl_arguments;
  28. + if (TREE_CODE (olddecl) == VAR_DECL)
  29. + DECL_COMMON (olddecl) = decl_common;
  30. }
  31.  
  32. /* If OLDDECL had its DECL_RTL instantiated, re-invoke make_decl_rtl
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement