Bug 8032 - GCC 4.5 prints wrong error message location when compiling via ccache
Summary: GCC 4.5 prints wrong error message location when compiling via ccache
Status: CLOSED INVALID
Alias: None
Product: ccache
Classification: Unclassified
Component: ccache (show other bugs)
Version: 3.1.4
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Joel Rosdahl
QA Contact: Joel Rosdahl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-22 16:02 UTC by joerg.richter
Modified: 2011-09-25 17:52 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description joerg.richter 2011-03-22 16:02:24 UTC
$ cat > foobar.h << EOF
enum Foo
{
  BAR
};
#define BAR(x) 
#define BARBAR BAR
EOF

$ cat > main.cc << EOF
#include "foobar.h"



void func()
{
  (void)BARBAR;
  aaa;
}
EOF

$ g++ -c main.cc
main.cc: In function 'void func()':
main.cc:8:3: error: 'aaa' was not declared in this scope

$ ccache g++ -c main.cc
foobar.h: In function 'void func()':
foobar.h:8:3: error: 'aaa' was not declared in this scope


Please notice the wrong filename when using ccache.

ccache 3.1.4
gcc 4.5.2
Comment 1 Joel Rosdahl 2011-03-22 21:30:51 UTC
This seems to be a regression in GCC 4.5:

    % /usr/bin/g++-4.4 -E main.cc >main.ii
    % /usr/bin/g++-4.4 -c main.ii         
    main.cc: In function ‘void func()’:
    main.cc:8: error: ‘aaa’ was not declared in this scope
    % /usr/bin/g++-4.5 -E main.cc >main.ii
    % /usr/bin/g++-4.5 -c main.ii         
    foobar.h: In function ‘void func()’:
    foobar.h:8:3: error: ‘aaa’ was not declared in this scope

This will be next to impossible to fix in ccache. Workaround: Set the CCACHE_CPP2 variable.
Comment 2 joerg.richter 2011-03-23 08:49:05 UTC
Thanks for your analysis. I've filed http://gcc.gnu.org/PR48248