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

            Bug ID: 115376
           Summary: ICE with if expression in value setting of a constant
                    declaration
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: p.p11 at orange dot fr
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

Steps to reproduce:
Get ALS source from als-25.0w-20240506-162AE-src.
Launch make:

% make BUILD_MODE=prod
...
gprbuild -m -j4  -XSUPERPROJECT= -P gnat/lsp_server.gpr -p -XBUILD_MODE=prod
-XOS=osx -XLIBRARY_TYPE=relocatable -XXMLADA_BUILD=relocatable
-XGPR_BUILD=relocatable \
        -XVERSION= -XBUILD_DATE=
lsp_server.gpr:28:09: warning: there are no sources of language "C++" in this
project
Compile
...
   [Ada]          lsp-ada_execute_command.adb
+===========================GNAT BUG DETECTED==============================+
| 13.2.0 (x86_64-apple-darwin21.6.0) GCC error:                            |
| in gnat_to_gnu_entity, at ada/gcc-interface/decl.cc:475                  |
| Error detected at lsp-ada_execute_command.adb:88:13     

      Command : constant Command_Access :=
          (if Tag = Ada.Tags.No_Tag then null
           else new LSP.Ada_Commands.Command'Class'
             (Create_Command (Tag, Params.arguments'Unrestricted_Access))); --
line 88

Compilation is correct if I change into:
      Command : Command_Access;
...
      if Tag = Ada.Tags.No_Tag then
        Command := null;
      else
        Command := new LSP.Ada_Commands.Command'Class'
           (Create_Command (Tag, Params.arguments'Unrestricted_Access));
      end if;

Reply via email to