[Issue 23102] New: pinholeopt, "Conditional jump or move depends on uninitialised value(s)"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 11 08:02:36 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=23102

          Issue ID: 23102
           Summary: pinholeopt, "Conditional jump or move depends on
                    uninitialised value(s)"
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

`to!string` on `string[]` seems to cause a memory error in pinholeopt

```test.d
module test;

import std.conv;

class Foo
{
    static string staticString;
    static void test(string[] a){
        staticString = to!string(a);
    }
}

void main()
{
    Foo.test([""]);
}  
```

```
valgrind dmd test.d
```

> ==1171031== Memcheck, a memory error detector
> ==1171031== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
> ==1171031== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
> ==1171031== Command: dmd test.d
> ==1171031== 
> ==1171031== Conditional jump or move depends on uninitialised value(s)
> ==1171031==    at 0x4D2D65: pinholeopt(code*, block*) (in /usr/bin/dmd)
> ==1171031==    by 0x509930: codgen(Symbol*) (in /usr/bin/dmd)
> ==1171031==    by 0x550BAA: writefunc2(Symbol*) (in /usr/bin/dmd)
> ==1171031==    by 0x550487: writefunc(Symbol*) (in /usr/bin/dmd)
> ==1171031==    by 0x249186: FuncDeclaration_toObjFile(FuncDeclaration*, bool) > (in /usr/bin/dmd)
> ==1171031==    by 0x250360: toObjFile::ToObjFile::visit(TemplateInstance*) (in > /usr/bin/dmd)
> ==1171031==    by 0x2748F1: genObjFile(Module*, bool) (in /usr/bin/dmd)
> ==1171031==    by 0x273A49: _D3dmd4glue20generateCodeAndWriteFACQBi7dmodule6ModuleAPxaAxaQdbbbbbZv (in /usr/bin/dmd)
> ==1171031==    by 0x46D6E5: _D3dmd4mars7tryMainFmPPxaKSQz7globals5ParamZi (in > /usr/bin/dmd)
> ==1171031==    by 0x4748FD: _Dmain (in /usr/bin/dmd)
> ==1171031==    by 0x5A1587: _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv > (in /usr/bin/dmd)
> ==1171031==    by 0x5A1484: _d_run_main2 (in /usr/bin/dmd)
> ==1171031== 
> ==1171031== 
> ==1171031== HEAP SUMMARY:
> ==1171031==     in use at exit: 132,007,920 bytes in 177,642 blocks
> ==1171031==   total heap usage: 230,785 allocs, 53,143 frees, 140,442,533 bytes allocated
> ==1171031== 
> ==1171031== LEAK SUMMARY:
> ==1171031==    definitely lost: 1,941,960 bytes in 31,054 blocks
> ==1171031==    indirectly lost: 742,311 bytes in 23,006 blocks
> ==1171031==      possibly lost: 8,142,415 bytes in 8,665 blocks
> ==1171031==    still reachable: 121,181,234 bytes in 114,917 blocks
> ==1171031==                       of which reachable via heuristic:
> ==1171031==                         multipleinheritance: 17,824,704 bytes in 17 blocks
> ==1171031==         suppressed: 0 bytes in 0 blocks
> ==1171031== Rerun with --leak-check=full to see details of leaked memory
> ==1171031== 
> ==1171031== Use --track-origins=yes to see where uninitialised values come from
> ==1171031== For lists of detected and suppressed errors, rerun with: -s
> ==1171031== ERROR SUMMARY: 12 errors from 1 contexts (suppressed: 0 from 0)

--


More information about the Digitalmars-d-bugs mailing list