[Git][ghc/ghc][master] rts/libdw: Silence uninitialized usage warnings

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Mon Dec 19 00:35:21 UTC 2022



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
761c1f49 by Ben Gamari at 2022-12-18T19:35:00-05:00
rts/libdw: Silence uninitialized usage warnings

As noted in #22538, previously some GCC versions warned that various
locals in Libdw.c may be used uninitialized. Although this wasn't
strictly true (since they were initialized in an inline assembler block)
we fix this by providing explicit empty initializers.

Fixes #22538
- - - - -


1 changed file:

- rts/Libdw.c


Changes:

=====================================
rts/Libdw.c
=====================================
@@ -290,7 +290,7 @@ static bool set_initial_registers(Dwfl_Thread *thread, void *arg);
 #if defined(x86_64_HOST_ARCH)
 static bool set_initial_registers(Dwfl_Thread *thread,
                                   void *arg STG_UNUSED) {
-    Dwarf_Word regs[17];
+    Dwarf_Word regs[17] = {};
     __asm__ ("movq %%rax, 0x00(%0)\n\t"
              "movq %%rdx, 0x08(%0)\n\t"
              "movq %%rcx, 0x10(%0)\n\t"
@@ -318,7 +318,7 @@ static bool set_initial_registers(Dwfl_Thread *thread,
 #elif defined(i386_HOST_ARCH)
 static bool set_initial_registers(Dwfl_Thread *thread,
                                   void *arg STG_UNUSED) {
-    Dwarf_Word regs[9];
+    Dwarf_Word regs[9] = {};
     __asm__ ("movl %%eax, 0x00(%0)\n\t"
              "movl %%ecx, 0x04(%0)\n\t"
              "movl %%edx, 0x08(%0)\n\t"
@@ -339,7 +339,7 @@ static bool set_initial_registers(Dwfl_Thread *thread,
 #elif defined(s390x_HOST_ARCH)
 static bool set_initial_registers(Dwfl_Thread *thread,
                                   void *arg STG_UNUSED) {
-    Dwarf_Word regs[32];
+    Dwarf_Word regs[32] = {};
     __asm__ ("stmg %%r0,%%r15,0(%0)\n\t"
              "std  %%f0,  128(0,%0)\n\t"
              "std  %%f2,  136(0,%0)\n\t"



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/761c1f49f55afc9a9f290fafb48885c2033069ed

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/761c1f49f55afc9a9f290fafb48885c2033069ed
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221218/9242da35/attachment-0001.html>


More information about the ghc-commits mailing list