zcourts / include-what-you-use

Automatically exported from code.google.com/p/include-what-you-use
Other
0 stars 0 forks source link

iwyu crash on file than clang++ compiles fine #42

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?  Give the *exact* arguments passed
to include-what-you-use, and attach the input source file that gives the
problem (minimal test-cases are much appreciated!)
1. include-what-you-use Foo.cpp
2.
3.

What is the expected output? What do you see instead?
0.  <eof> parser at end of file
1.  source/Foo.cpp:4:3: instantiating function definition 'Foo'
Segmentation fault (core dumped)

What version of the product are you using? On what operating system?
iwyu: rev 255, llvm/clang: 132185

Please provide any additional information below.
The file compiles fine with clang++ -c Foo.cpp

Foo.cpp:
class Foo
{
 public:
  Foo(const char* s);
};

Original issue reported on code.google.com by jonas.bu...@gmail.com on 27 May 2011 at 7:50

GoogleCodeExporter commented 9 years ago
Subjet: s/than/that/ , sorry :-)

Original comment by jonas.bu...@gmail.com on 27 May 2011 at 7:51

GoogleCodeExporter commented 9 years ago
I believe this should be fixed by r256.

Original comment by csilv...@gmail.com on 27 May 2011 at 10:59

GoogleCodeExporter commented 9 years ago
Using the repro above, I'm seeing a crash with GetOptLong trying to index argv 
with an optind of -1. The attached patch fixes this.

Original comment by paul.hol...@gmail.com on 28 May 2011 at 1:02

Attachments:

GoogleCodeExporter commented 9 years ago
Yes, the crash is gone in r256.

Original comment by jonas.bu...@gmail.com on 28 May 2011 at 3:04

GoogleCodeExporter commented 9 years ago
Re comment #2: I've decided to resolve this another way, by initializing optind 
to 0 in iwyu_globals.cc.

Original comment by csilv...@gmail.com on 1 Jun 2011 at 12:07