goplus / c2go

Convert C to Go
Apache License 2.0
306 stars 21 forks source link

alias in complicate stmt redeclared #162

Closed visualfc closed 1 year ago

visualfc commented 1 year ago

main.go

#include <stdio.h>

int main() {
    goto tt;
    do {
        typedef int __attribute__((__may_alias__)) w32;
        w32 j;
tt:
        j = 0;
        printf("%d\n",j);
        break;
    } while(1);
    goto tt2;
    do {
        typedef short __attribute__((__may_alias__)) w32;
        w32 j;
tt2:
        j = 0;
        printf("%d\n",j);
        break;
    } while(1);
}

c2go main.go w32 redeclared in this block

func _cgo_main() int32 {
    var (
        j_cgo1 int32
        j_cgo2 int16
    )
    goto tt
_cgol_1:
    type w32 = int32
    j_cgo1 = 0
tt:
    j_cgo1 = int32(0)
    printf((*int8)(unsafe.Pointer(&[4]int8{'%', 'd', '\n', '\x00'})), j_cgo1)
    goto _cgol_2
    if int32(1) != 0 {
        goto _cgol_1
    }
_cgol_2:
    goto tt2
_cgol_3:
    type w32 = int16
    j_cgo2 = 0
tt2:
    j_cgo2 = int16(0)
    printf((*int8)(unsafe.Pointer(&[4]int8{'%', 'd', '\n', '\x00'})), j_cgo2)
    goto _cgol_4
    if int32(1) != 0 {
        goto _cgol_3
    }
_cgol_4:
    return 0
}