http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60484

            Bug ID: 60484
           Summary: -fdump-rtl-expand and attribute optimize gives
                    incorrect dump file path
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: secondary.mail7865220 at gmail dot com

Created attachment 32324
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32324&action=edit
test.c - Source to trigger the bug

To trigger this bug, three conditions must be met:
- At least one function must be annotated with "__attribute__((optimize))".
- The object file is placed in a sub-directory to where the source file is
located.
- The flag -fdump-rtl-expand is used.

The path to the directory where the dump file is supposed to be saved is
prepended the same number of times as there are functions with "attribute
optimize" in the source C file.

Compiler output:
$ gcc -std=c99 -fdump-rtl-expand -o objs/test.o -c test.c
test.c: In function ‘Optimized_1’:
test.c:3:1: error: could not open dump file
‘objs/objs/objs/test.c.166r.expand’: No such file or directory
Optimized_1(int arg)
 ^
test.c: In function ‘Optimized_2’:
test.c:10:1: error: could not open dump file
‘objs/objs/objs/test.c.166r.expand’: No such file or directory
Optimized_2(int arg)
 ^
test.c: In function ‘main’:
test.c:15:5: error: could not open dump file
‘objs/objs/objs/test.c.166r.expand’: No such file or directory
 int main()
     ^

Compiler version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure
Thread model: posix
gcc version 4.8.2 (GCC)

System type:
$ uname -a
Linux jf-linux 3.4.63-2.44-desktop #1 SMP PREEMPT Wed Oct 2 11:18:32 UTC 2013
(d91a619) x86_64 x86_64 x86_64 GNU/Linux

Reply via email to