Hi Moritz, On 05/21/2015 09:56 AM, Pflanzer, Moritz wrote:
Hello, I found that clang_delta seems to produce a segmentation fault if the file that should be reduced contains a #define preprocessor directive for a type. To produce the error this small program is enough: #define my_type int my_type my_var; I ran the following test: $ clang_delta --transformation=remove-unused-var --counter=1 ./my_prog.c
Thanks for reporting this.Dealing with macros is one of the weak part in clang_delta. In the early stage of developing clang_delta, I made an (bad) assumption that the best use of clang_delta is for preprocessed programs, and therefore overlooked a lots of places where macros come to play.
I committed a simple patch that fixed the crash in remove-unused-var pass that you mentioned. However, I am pretty sure there are other issues relevant to macros. These issues may require certain amount of effort to resolve.
Thanks, - Yang