Bug 45260 - [4.5/4.6 Regression] g++4.5: -prefetch-loop-arrays internal compiler error: in verify_expr, at tree-cfg.c:2541
Summary: [4.5/4.6 Regression] g++4.5: -prefetch-loop-arrays internal compiler error: i...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.5.1
: P3 normal
Target Milestone: 4.5.2
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-11 20:26 UTC by Török Edwin
Modified: 2010-08-30 15:55 UTC (History)
3 users (show)

See Also:
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
Build: x86_64-linux-gnu
Known to work: 4.4.4
Known to fail: 4.5.1
Last reconfirmed: 2010-08-11 23:58:42


Attachments
TargetLowering.ii (179.53 KB, application/octet-stream)
2010-08-11 20:27 UTC, Török Edwin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Török Edwin 2010-08-11 20:26:22 UTC
See https://wwws.clamav.net/bugzilla/show_bug.cgi?id=2190

$ g++-4.5 -fprefetch-loop-arrays TargetLowering.ii -c -O2
../../../../clamav-devel/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp: In member function ‘void llvm::TargetLowering::computeRegisterProperties()’:
../../../../clamav-devel/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:608:6: internal compiler error: in verify_expr, at tree-cfg.c:2541
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.

g++-4.4 works:
$ g++-4.4 -fprefetch-loop-arrays TargetLowering.ii -c -O2

$ g++-4.5 -v
Using built-in specs.
COLLECT_GCC=/usr/bin/g++-4.5
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.5.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.5.1-1' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --program-suffix=-4.5 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --with-plugin-ld=ld.gold --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=yes --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.5.1 (Debian 4.5.1-1)
Comment 1 Török Edwin 2010-08-11 20:27:36 UTC
Created attachment 21457 [details]
TargetLowering.ii
Comment 2 H.J. Lu 2010-08-11 23:58:42 UTC
It was caused by revision 153878:

http://gcc.gnu.org/ml/gcc-cvs/2009-11/msg00094.html

and disappeared with revision 159514:

http://gcc.gnu.org/ml/gcc-cvs/2010-05/msg00566.html

I am not if it really fixed the bug.
Comment 3 Changpeng Fang 2010-08-12 00:38:30 UTC
(In reply to comment #2)
> It was caused by revision 153878:
> 
> http://gcc.gnu.org/ml/gcc-cvs/2009-11/msg00094.html
> 

I think the same patch was also committed to 4.4 branch.
Maybe some prefetch work(s) in 4.5 triggered the bug.  

> and disappeared with revision 159514:
> 
> http://gcc.gnu.org/ml/gcc-cvs/2010-05/msg00566.html
> 
> I am not if it really fixed the bug.
> 

This could not be a valid fix, because it just disable some prefetches
based on performance concern.

Comment 4 Changpeng Fang 2010-08-16 22:39:38 UTC
This bug should be related to VIEW_CONVERT_EXPR.

If I use the following statement to filter the prefetch, the bug will go away:

if (contains_view_convert_expr_p (ref))
    return false;


Otherwise, the prefetch pass will generate "ref + offset" as the prefetching address.
  
Comment 5 Changpeng Fang 2010-08-20 22:48:04 UTC
I have a fix:
http://gcc.gnu.org/ml/gcc-patches/2010-08/msg01625.html
Comment 6 Changpeng Fang 2010-08-23 18:59:18 UTC
Committed to trunk as Revision: 163475:
http://gcc.gnu.org/ml/gcc-cvs/2010-08/msg00688.html

Committed to 4.5 branch as Revision: 163483
http://gcc.gnu.org/ml/gcc-cvs/2010-08/msg00696.html
Comment 7 Richard Biener 2010-08-30 15:55:44 UTC
Fixed.  Changpeng, please remember to add PR tree-optimization/45260 to commit
messages (well, paste aggregated changelog entries there).