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

            Bug ID: 116945
           Summary: Valgrind reports uninitialized memory use in
                    sem_ch12.adb
                    (sem_ch12__instance_context__save_and_reset)
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

hello.adb:
```
with Text_IO; use Text_IO;
procedure hello is
begin
   Put_Line("Hello world!");
end hello;
```

```
$ valgrind -q --track-origins=yes --exit-on-first-error=yes --error-exitcode=2
--trace-children=yes /home/sam/build/bisect-gcc-pfx/bin/gnatmake hello.adb -f
--GCC=/home/sam/build/bisect-gcc-pfx/bin/gcc
/home/sam/build/bisect-gcc-pfx/bin/gcc -c hello.adb
==3711124== Conditional jump or move depends on uninitialised value(s)
==3711124==    at 0xB88C0F: sem_ch12__instance_context__save_and_reset
(sem_ch12.adb:18574)
==3711124==    by 0xB52C51: rtsfind__load_rtu (rtsfind.adb:1191)
==3711124==    by 0xB540BA: rtsfind__rte (rtsfind.adb:1561)
==3711124==    by 0xA3820B: exp_ch11__expand_n_exception_declaration
(exp_ch11.adb:1192)
==3711124==    by 0xADD00F: expander__expand (expander.adb:252)
==3711124==    by 0xB5A928: sem__analyze (sem.adb:830)
==3711124==    by 0xBCEC85: sem_ch3__analyze_declarations (sem_ch3.adb:2761)
==3711124==    by 0xC10919: sem_ch7__analyze_package_specification
(sem_ch7.adb:1711)
==3711124==    by 0xB5A4C7: sem__analyze (sem.adb:466)
==3711124==    by 0xC10451: sem_ch7__analyze_package_declaration
(sem_ch7.adb:1227)
==3711124==    by 0xB5A4A3: sem__analyze (sem.adb:457)
==3711124==    by 0xB8166E: sem_ch10__analyze_compilation_unit
(sem_ch10.adb:1152)
==3711124==  Uninitialised value was created by a heap allocation
==3711124==    at 0x4A95A43: malloc (vg_replace_malloc.c:446)
==3711124==    by 0x2DCF7E3: __gnat_malloc (s-memory.adb:79)
==3711124==    by 0xB87039: sem_ch12__generic_renamings__reallocateX
(table.adb:208)
==3711124==    by 0xB87101: sem_ch12__generic_renamings__initX (table.adb:147)
==3711124==    by 0xB9E13C: sem_ch12___elabb (table.adb:393)
==3711124==    by 0xD14551: adainit (b_gnat1.adb:744)
==3711124==    by 0x9227CF: gnat_parse_file() (misc.cc:117)
==3711124==    by 0x13137BC: compile_file() (toplev.cc:452)
==3711124==    by 0x1314D2A: do_compile() (toplev.cc:2210)
==3711124==    by 0x13156B5: toplev::main(int, char**) (toplev.cc:2370)
==3711124==    by 0x2CD89EA: main (main.cc:39)
==3711124==
==3711124==
==3711124== Exit program on first error (--exit-on-first-error=yes)
gnatmake: "hello.adb" compilation error
```

GCC was built with --enable-valgrind-annotations and -Og.

Reply via email to