Bug 35493 - [4.4 Regression] Assert_Failure uintp.adb:1593
Summary: [4.4 Regression] Assert_Failure uintp.adb:1593
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 4.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on: 35494
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-07 02:24 UTC by John David Anglin
Modified: 2008-03-10 19:44 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-03-07 16:46:14


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2008-03-07 02:24:11 UTC
/Users/dave/gnu/gcc/objdir/./prev-gcc/xgcc -B/Users/dave/gnu/gcc/objdir/./prev-g
cc/ -B/opt/gnu/gcc/gcc-4.4.0/i686-apple-darwin9/bin/ -c -g -O2 -fomit-frame-poin
ter      -gnatpg -gnata -nostdinc -I- -I. -Iada -I../../gcc/gcc/ada ../../gcc/gc
c/ada/ada.ads -o ada/ada.o
+===========================GNAT BUG DETECTED==============================+
| 4.4.0 20080307 (experimental) [trunk revision 132999] (i686-apple-darwin9) |
| Assert_Failure uintp.adb:1593                                            |
| No source file position information available                            |

This occurs in stage3.  Build yesterday was ok.
Comment 1 Andreas Schwab 2008-03-07 10:48:27 UTC
This was caused by this change:

2008-03-06  Andrew Pinski  <andrew_pinski@playstation.sony.com>

       PR tree-opt/35402
       * tree-ssa-ccp.c (get_symbol_constant_value): Handle
       integral and scalar float variables which have a
       NULL DECL_INITIAL.
Comment 2 Andrew Pinski 2008-03-07 11:59:13 UTC
This has to be a bug in the Ada front-end because all the rest of the middle-end assumes that if DECL_INITIAL is NULL, the value is going to be zero.  I might be the case where TREE_READONLY is being set and it should not be as the variable is not readonly.
Comment 3 Andrew Pinski 2008-03-07 12:05:37 UTC
I think the Ada front-end has TREE_CONSTANT and TREE_READONLY definition swapped around:

  /* Whether we will make TREE_CONSTANT the DECL we produce here, in which
     case the initializer may be used in-lieu of the DECL node (as done in
     Identifier_to_gnu).  This is useful to prevent the need of elaboration
     code when an identifier for which such a decl is made is in turn used as
     an initializer.  We used to rely on CONST vs VAR_DECL for this purpose,
     but extra constraints apply to this choice (see below) and are not
     relevant to the distinction we wish to make. */ 
  bool constant_p = const_flag && init_const;

  TREE_READONLY (var_decl) = const_flag;
  DECL_EXTERNAL (var_decl) = extern_flag;
  TREE_PUBLIC   (var_decl) = public_flag || extern_flag;
  TREE_CONSTANT (var_decl) = constant_p;



READ_ONLY means it is only read and not written to at all and the initializer is valid.
Comment 4 Andreas Schwab 2008-03-07 14:59:52 UTC
The patch in <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35494#c6> works here as well.
Comment 5 Eric Botcazou 2008-03-07 16:46:14 UTC
Based on Andreas' latest comment.  The Ada FE may need inspection though.
Comment 6 Eric Botcazou 2008-03-07 18:28:44 UTC
> I think the Ada front-end has TREE_CONSTANT and TREE_READONLY definition
> swapped around:
> 
>   /* Whether we will make TREE_CONSTANT the DECL we produce here, in which
>      case the initializer may be used in-lieu of the DECL node (as done in
>      Identifier_to_gnu).  This is useful to prevent the need of elaboration
>      code when an identifier for which such a decl is made is in turn used
>      an initializer.  We used to rely on CONST vs VAR_DECL for this purpose,
>      but extra constraints apply to this choice (see below) and are not
>      relevant to the distinction we wish to make. */ 
>   bool constant_p = const_flag && init_const;
> 
>   TREE_READONLY (var_decl) = const_flag;
>   DECL_EXTERNAL (var_decl) = extern_flag;
>   TREE_PUBLIC   (var_decl) = public_flag || extern_flag;
>   TREE_CONSTANT (var_decl) = constant_p;

This doesn't seem to be the case according to
  http://gcc.gnu.org/ml/gcc/2005-08/msg00686.html
Comment 7 Laurent GUERBY 2008-03-08 20:45:05 UTC
For reference H. J. Lu proposed patch (for C++):

http://gcc.gnu.org/ml/gcc-patches/2008-03/msg00466.html
Comment 8 Serge Belyshev 2008-03-10 19:44:38 UTC
Patch for bug 35494 was committed, so this PR should be fixed now too.