[LLVMbugs] [Bug 9373] New: outer array dimension size bug when defined with initializer

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Mar 2 12:12:08 PST 2011


           Summary: outer array dimension size bug when defined with
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: impulze at impulze.org
                CC: llvmbugs at cs.uiuc.edu

Hey there, I'm facing a bug regarding outer array sizes if it is initialized at
the definition. Details below. If more information is required feel free to

impulze at istari ~/clang $ gcc -ansi -pedantic -Wall -Wextra -o a.out main.c &&
0x601220 0x607fd0 28080
tests: teststring array1 teststring array2
tests:  teststring array2
impulze at istari ~/clang $ cat main.c 
#include <stdio.h>
#include <string.h>

char array1[351][80] =
    "teststring array1"

char array2[][20] =
    "teststring array2",

int main()
    printf("%ld\n", sizeof(array1));
    printf("%p %p %ld\n", (void *)array1, (void *)array2, (char *)array2 -
(char *)array1);
    printf("tests: %s %s\n", array1[0], array2[0]);
    memset(array1[0], 0, sizeof array1);
    printf("tests: %s %s\n", array1[0], array2[0]);

    return 0;
impulze at istari ~/clang-wchar $ clang -v
clang version 2.9 (/var/cache/paludis/distfiles/scm/clang
Target: x86_64-pc-linux-gnu
Thread model: posix

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list