re PR target/88777 (Out-of-range offsets building glibc test-tgmath2.c for hppa-linux...
authorJan Hubicka <hubicka@ucw.cz>
Tue, 12 Feb 2019 11:25:11 +0000 (12:25 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 12 Feb 2019 11:25:11 +0000 (11:25 +0000)
PR lto/88777
* cgraphunit.c (analyze_functions): Clear READONLY flag for external
types that needs constructiong.
* tree.h (may_be_aliased): Do not check TYPE_NEEDS_CONSTRUCTING.

From-SVN: r268791

gcc/ChangeLog
gcc/cgraphunit.c
gcc/tree.h

index fd015eb2be6ede34ac82307943025ac38af24094..c430e9d5ecd620a6ddc1207b1cc58845190d8ae4 100644 (file)
@@ -1,3 +1,10 @@
+2019-02-12  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR lto/88777
+       * cgraphunit.c (analyze_functions): Clear READONLY flag for external
+       types that needs constructiong.
+       * tree.h (may_be_aliased): Do not check TYPE_NEEDS_CONSTRUCTING.
+
 2019-02-12  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/89253
index a7c9b9ac249acbd78372a14d3ed21ced826a0857..162e0049b6bf35bd8dfdbaa457d07781fc0a338c 100644 (file)
@@ -1226,6 +1226,15 @@ analyze_functions (bool first_time)
        && node != first_handled_var; node = next)
     {
       next = node->next;
+      /* For symbols declared locally we clear TREE_READONLY when emitting
+        the construtor (if one is needed).  For external declarations we can
+        not safely assume that the type is readonly because we may be called
+        during its construction.  */
+      if (TREE_CODE (node->decl) == VAR_DECL
+         && TYPE_P (TREE_TYPE (node->decl))
+         && TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (node->decl))
+         && DECL_EXTERNAL (node->decl))
+       TREE_READONLY (node->decl) = 0;
       if (!node->aux && !node->referred_to_p ())
        {
          if (symtab->dump_file)
index a1c30e42cce5cbb4c7a561e23d8a51938fce594d..96d84d961c58a834eaa76ad33b119219fe07fcc6 100644 (file)
@@ -5382,8 +5382,7 @@ may_be_aliased (const_tree var)
              || DECL_EXTERNAL (var)
              || TREE_ADDRESSABLE (var))
          && !((TREE_STATIC (var) || TREE_PUBLIC (var) || DECL_EXTERNAL (var))
-              && ((TREE_READONLY (var)
-                   && !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (var)))
+              && (TREE_READONLY (var)
                   || (TREE_CODE (var) == VAR_DECL
                       && DECL_NONALIASED (var)))));
 }