Bug 115376 - ICE with if expression in value setting of a constant declaration
Summary: ICE with if expression in value setting of a constant declaration
Status: WAITING
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 13.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-06 20:01 UTC by Pascal Pignard
Modified: 2024-06-13 12:48 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2024-06-07 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Pignard 2024-06-06 20:01:43 UTC
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;
Comment 1 Eric Botcazou 2024-06-07 08:55:17 UTC
See https://gcc.gnu.org/bugs/#gnat for instructions on how to report a bug.
Comment 2 Pascal Pignard 2024-06-12 19:09:09 UTC
After trying and several attempts to find a small reproducer, I'm afraid that I won't be able to provide better help than the ALS team could.
Comment 3 Eric Botcazou 2024-06-13 12:48:32 UTC
> After trying and several attempts to find a small reproducer, I'm afraid
> that I won't be able to provide better help than the ALS team could.

Note that a small reproducer is not mandatory, so it's usually just a matter of concatenating the sources files listed in the bug box, optionally compressing the result and attaching it to the PR.