]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/22589 (ICE casting to long long)
authorRichard Sandiford <richard@codesourcery.com>
Thu, 28 Jul 2005 08:08:25 +0000 (08:08 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 28 Jul 2005 08:08:25 +0000 (08:08 +0000)
PR c/22589
Backport from mainline:

2004-06-16  Alexandre Oliva  <aoliva@redhat.com>
* tree.c (get_narrower): Don't narrow integral types into
non-integral types.

From-SVN: r102471

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/tree.c

index 72fba35bca1498cff7d8c20e3b276055ea92ea00..ec9f065d9b21c86c0405a5fefad5ae88aabef215 100644 (file)
@@ -1,3 +1,12 @@
+2005-07-28  Richard Sandiford  <richard@codesourcery.com>
+
+       PR c/22589
+       Backport from mainline:
+
+       2004-06-16  Alexandre Oliva  <aoliva@redhat.com>
+       * tree.c (get_narrower): Don't narrow integral types into
+       non-integral types.
+
 2005-07-26  Bernardo Innocenti  <bernie@develer.com>
 
        Backport from mainline:
index 7233b8c65a980d82a15b4240462705b62023bd80..db8235038775af8c95f34d21e7205028f62e9994 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-28  Richard Sandiford  <richard@codesourcery.com>
+
+       PR c/22589
+       * gcc.c-torture/compile/pr22589.c: New test.
+
 2005-07-25  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
 
        PR c++/19208
index 1d1a8e375ddf455633526b6235db7a5341fa2954..aa5c35842bb6bfae7875c392b1f579f2235b41f0 100644 (file)
@@ -4156,6 +4156,7 @@ get_narrower (tree op, int *unsignedp_ptr)
   int uns = 0;
   int first = 1;
   tree win = op;
+  bool integral_p = INTEGRAL_TYPE_P (TREE_TYPE (op));
 
   while (TREE_CODE (op) == NOP_EXPR)
     {
@@ -4192,6 +4193,10 @@ get_narrower (tree op, int *unsignedp_ptr)
            uns = TREE_UNSIGNED (TREE_TYPE (op));
          first = 0;
          op = TREE_OPERAND (op, 0);
+         /* Keep trying to narrow, but don't assign op to win if it
+            would turn an integral type into something else.  */
+         if (INTEGRAL_TYPE_P (TREE_TYPE (op)) != integral_p)
+           continue;
        }
 
       win = op;