Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang preprocessor crashes when using -E -CC option on MFC code. #10455

Open Quuxplusone opened 13 years ago

Quuxplusone commented 13 years ago
Bugzilla Link PR10153
Status REOPENED
Importance P normal
Reported by Francois Pichet (pichet2000@gmail.com)
Reported on 2011-06-18 23:25:31 -0700
Last modified on 2015-08-05 02:13:32 -0700
Version trunk
Hardware PC Windows NT
CC akyrtzi@gmail.com, dieselmachine@mail.ru, eremeev@viva64.com, ismail@i10z.com, llvm-bugs@lists.llvm.org, pichet2000@gmail.com, rafael@espindo.la
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
If you are trying to get the preprocessed output file of a MFC file using the -
E -CC options, clang will crash.

Here is a reduction:
test.cpp:
#define A text//\

clang -E -CC test.cpp
Quuxplusone commented 13 years ago

_Bug 10683 has been marked as a duplicate of this bug._

Quuxplusone commented 13 years ago

It has nothing to do with MFC though. Any file containing "//\" with an empty line afterwards will cause a crash.

Quuxplusone commented 13 years ago
This code:
  // \
int a; //dead line

Will be preprocessed as:
 // int a; //dead line

Thus the second line is lost.
Quuxplusone commented 12 years ago

Fixed in r147091.

Quuxplusone commented 9 years ago
The bug is active in clang 3.6.2. This code:

int main(int argc, char* argv[]) {
    // \
    int a; //dead line
    int b;
    return 0;
}

is preprocessed as:

int main(int argc, char* argv[]) {

    int b;
    return 0;
}