http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49084

--- Comment #13 from Cesar Strauss <cestrauss at gmail dot com> 2011-11-28 
00:46:16 UTC ---
(In reply to comment #12)
> Zero is UNKNOWN_LOCATION.  The problem is probably that the location mapping
> isn't initialized yet.  What happens if you move the block in gigi:
> 
>   gcc_assert (Nkind (gnat_root) == N_Compilation_Unit);
> 
>   /* Declare the name of the compilation unit as the first global
>      name in order to make the middle-end fully deterministic.  */
>   t = create_concat_name (Defining_Entity (Unit (gnat_root)), NULL);
>   first_global_object_name = ggc_strdup (IDENTIFIER_POINTER (t));
> 
> to after the immediately following loop?

+===========================GNAT BUG DETECTED==============================+
| 4.7.0 20111126 (experimental) [trunk revision 181738] (mingw32)          |
| Program_Error sem_util.adb:2551 explicit raise                           |
| Error detected at system.ads:175:5                                       |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact gcc or gnatmake command that you entered.              |
| Also include sources listed below in gnatchop format                     |
| (concatenated together with no headers between files).                   |
+==========================================================================+

(gdb) b sem_util.adb:2551
Breakpoint 8 at 0x6b40f8: file ../../../../gcc-svn-fixada/gcc/ada/sem_util.adb,
line 2551.
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) [answered Y; input not from terminal]
Starting program: c:\projetos\gcc\bld\svn\bld-fixada-3\gcc\gnat1.exe -I - -I .
-I ada -I ../../../../gcc-svn-fixada/gcc/ada -I
../../../../gcc-svn-fixada/gcc/ada/gcc-interface -gnatwa -quiet -nostdinc
-dumpbase a-charac.ads -auxbase-strip ada/a-charac.o -O2
-Wno-pedantic-ms-format -Wextra -Wall -g -gnatpg -gnata -mtune=i386 -march=i386
-gnatO ada/a-charac.o ../../../../gcc-svn-fixada/gcc/ada/a-charac.ads -o
ccOjhV0T.s
[New Thread 3492.0x804]
gnat1.exe: warning: command line option '-Wno-pedantic-ms-format' is valid for
C/C++/ObjC/ObjC++ but not for Ada [enabled by default]

Breakpoint 8, sem_util.defining_entity (n=0) at
../../../../gcc-svn-fixada/gcc/ada/sem_util.adb:2551
2551                raise Program_Error;

(gdb) p Nkind(N)
$1 = n_empty

(gdb) fr 1
#1  0x0048ff0c in gigi (gnat_root=1707, max_gnat_node=2431, number_name=1656,
nodes_ptr=0x7950020, next_node_ptr=0x78b52f8, prev_node_ptr=0x78e6050,
elists_ptr=0x7708e78, elmts_ptr=0x77094d0, strings_ptr=0x7734818,
string_chars_ptr=0x77320f0, list_headers_ptr=0x78a9760, number_file=3,
file_info_ptr=0x722fb9c, standard_boolean=12, standard_integer=27,
standard_character=72, standard_long_long_float=67,
standard_exception_type=1281, gigi_operating_mode=0) at
../../../../gcc-svn-fixada/gcc/ada/gcc-interface/trans.c:302
302       t = create_concat_name (Defining_Entity (Unit (gnat_root)), NULL);

> > (gdb) p gnat_root
> > $3 = 1707
> > 
> > (gdb) p (Nodes_Ptr[(gnat_root) - 0].U.K.kind)
> > $4 = 17 '\021'
> 
> Use 'call pn(gnat_root)' instead.

(gdb) call pn(gnat_root)
N_Compilation_Unit (Node_Id=1707) (source,analyzed)
 Parent = <empty>
 Sloc = 9966  a-charac.ads:16:12
 Context_Items = List (List_Id=-99999988)
 Unit = N_Package_Declaration (Node_Id=1722)
 Aux_Decls_Node = N_Compilation_Unit_Aux (Node_Id=1708)

It seems OK to me on the Ada side. I wonder what makes it trigger the assertion
gcc_assert (Nkind (gnat_root) == N_Compilation_Unit)

Maybe the C accessor "Nkind" is not working well for some reason?

Reply via email to