Open marxin opened 4 years ago
Hmm, I couldn't reproduce the segfault. The test worked for me:
$ ./clang_delta --transformation=empty-struct-to-int --counter=1 /home/marxin/Programming/cvise/clang_delta/tests/empty-struct-to-int/empty-struct6.c
// RUN: %clang_delta --transformation=empty-struct-to-int --counter=1 %s 2>&1 | %remove_lit_checks | FileCheck %s
// CHECK: int a = 0;
int a = 0;
I am using LLVM 9.0.0 though. I will try 9.0.1 tomorrow. Thanks.
It's quite interesting that it does not happen in valgrind:
$ valgrind --expensive-definedness-checks=yes ./clang_delta/clang_delta --transformation=empty-struct-to-int --counter=1 /home/marxin/Programming/cvise/clang_delta/tests/empty-struct-to-int/empty-struct6.c
==12048== Memcheck, a memory error detector
==12048== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==12048== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==12048== Command: ./clang_delta/clang_delta --transformation=empty-struct-to-int --counter=1 /home/marxin/Programming/cvise/clang_delta/tests/empty-struct-to-int/empty-struct6.c
==12048==
int a = 0;
==12048==
==12048== HEAP SUMMARY:
==12048== in use at exit: 91,534 bytes in 1,532 blocks
==12048== total heap usage: 2,825 allocs, 1,293 frees, 1,243,630 bytes allocated
==12048==
==12048== LEAK SUMMARY:
==12048== definitely lost: 0 bytes in 0 blocks
==12048== indirectly lost: 0 bytes in 0 blocks
==12048== possibly lost: 0 bytes in 0 blocks
==12048== still reachable: 91,534 bytes in 1,532 blocks
==12048== suppressed: 0 bytes in 0 blocks
==12048== Rerun with --leak-check=full to see details of leaked memory
==12048==
==12048== For lists of detected and suppressed errors, rerun with: -s
==12048== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Not sure what's going on. The test also passed with LLVM 9.0.1 on my Ubuntu 18.04.
I bet there's some location offset underflow, but hard to guess.
I see a segfault with LLVM9:
as seen the location Length is
4294967295
with is(int)-1
. So an integer underflow.