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

--- Comment #12 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2011-11-27 
22:06:23 UTC ---
> The cause of the access violation is due to an attempt to pass a null string
> pointer to asprintf in internal_error_function
> (gcc/ada/gcc-interface/misc.c:290):

Thanks for the investigation.

> It remains to be seen why input_location is zero. Maybe it's too early in the
> process execution?

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?

> (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.

> It seems Nkind (gnat_root) is N_Op_Add (17) for some reason.
> 
> BTW this is trunk (svn 181738), with the stage 2 compiler (this bug is not
> manifest in the stage 1 compiler).

This very likely means that the stage 1 compiler has miscompiled the stage 2
compiler.

Reply via email to