Command line:
$ gcc testcase.c

$ cat testcase.c
static const int data[2048];

void foo (void *ptr)
  __builtin_memcmp (data, ptr, 1);

Relevant valgrind output:
$ valgrind --trace-children=yes
==13187== Invalid read of size 2
==13187==    at 0x6935CC: string_constant (expr.c:9863)
==13187==    by 0x57808E: c_getstr (builtins.c:580)
==13187==    by 0x59940E: fold_builtin_3 (builtins.c:8819)
==13187==    by 0x58C7FB: fold_builtin_n (builtins.c:10622)
==13187==    by 0x58EAE9: fold_builtin_call_array (builtins.c:10857)
==13187==    by 0x500B83: build_function_call_vec (c-typeck.c:2798)
==13187==    by 0x50C7CD: c_parser_postfix_expression_after_primary
==13187==    by 0x51063C: c_parser_postfix_expression (c-parser.c:5923)
==13187==    by 0x50972E: c_parser_unary_expression (c-parser.c:5322)
==13187==    by 0x50A642: c_parser_cast_expression (c-parser.c:5185)
==13187==    by 0x50A809: c_parser_binary_expression (c-parser.c:5001)
==13187==    by 0x50AF4C: c_parser_conditional_expression (c-parser.c:4782)
==13187==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
testcase.c: In function 'foo':
testcase.c:5:3: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <> for instructions.

Tested revisions:
r164484 - crash
r163636 - OK

           Summary: [4.6 Regression] ICE: SIGSEGV in string_constant
                    (expr.c:9863) when parsing memcmp()
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zsojka at seznam dot cz
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu

Reply via email to