https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116933

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Sam James from comment #2)
> I think this is a secondary problem (tell me if I should file a new PR), but
> we blow up w/ DEFERRED_INIT at -O1:
> ```
> gnatlink hello.ali -ftrivial-auto-var-init=zero -O1
> /usr/lib/gcc/x86_64-pc-linux-gnu/15/adainclude/s-secsta.ads: In function
> ‘system.secondary_stack.ss_stackIP’:
> /usr/lib/gcc/x86_64-pc-linux-gnu/15/adainclude/s-secsta.ads:279:9: error:
> location references block not in block tree
> &"_init"[0]
> SR.41_9 = .DEFERRED_INIT (8, 2, &"_init"[0]);
> during GIMPLE pass: einline
> +===========================GNAT BUG DETECTED==============================+
> | 15.0.0 20241001 (experimental) f72b1a44ff582041b02d5abe0a6c8556057e6183
> (x86_64-pc-linux-gnu) GCC error:|
> | verify_gimple failed                                                     |
> | Error detected around
> /usr/lib/gcc/x86_64-pc-linux-gnu/15/adainclude/s-secsta.ads:279:9|
> | Compiling /home/sam/build/ada/b~hello.adb                                |
> ```

That part should be easy to fix.
  location_t loc = EXPR_LOCATION (decl);

...

  if (DECL_NAME (decl))

    decl_name = build_string_literal (DECL_NAME (decl));

  else
    {
      char decl_name_anonymous[3 + (HOST_BITS_PER_INT + 2) / 3];
      sprintf (decl_name_anonymous, "D.%u", DECL_UID (decl));
      decl_name = build_string_literal (decl_name_anonymous);
    }

build_string_literal should take a loc and the loc gets passed to build1 for
the ADDR_EXPR.

Reply via email to