This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/82111] New: kcoreaddons-5.37.0: desktopfileparser.cpp miscompiled in dbr pass
- From: "danglin at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 06 Sep 2017 00:13:45 +0000
- Subject: [Bug rtl-optimization/82111] New: kcoreaddons-5.37.0: desktopfileparser.cpp miscompiled in dbr pass
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82111
Bug ID: 82111
Summary: kcoreaddons-5.37.0: desktopfileparser.cpp miscompiled
in dbr pass
Product: gcc
Version: 7.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: danglin at gcc dot gnu.org
Target Milestone: ---
Host: hppa-unknown-linux-gnu
Target: hppa-unknown-linux-gnu
Build: hppa-unknown-linux-gnu
Created attachment 42132
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42132&action=edit
Preprocessed source
The kdelibs4support fails to build on hppa due to a segmentation fault in
desktoptojson. This is debian bug #874312.
The fault occurs in __sync_sub_and_fetch_4. It occurs because the r26
argument register is not initialized before the call.
We have in ServiceTypeDefinition::parseValue(QByteArray const&, QString const&)
const the following code:
0x00018cac <+660>: ldw c(r6),r25
0x00018cb0 <+664>: ldw c(ret0),r26
0x00018cb4 <+668>: copy r5,r24
0x00018cb8 <+672>: add,l r6,r25,r25
0x00018cbc <+676>: b,l 0x13144,rp
0x00018cc0 <+680>: add,l ret0,r26,r26
0x00018cc4 <+684>: cmpib,<> 0,ret0,0x18ac0
<ServiceTypeDefinition::parseValue(QByteArray const&, QString const&)
const+168>
0x00018cc8 <+688>: copy r4,r19
0x00018ccc <+692>: ldw 4(r3),ret0
0x00018cd0 <+696>: ldo -1(ret0),ret0
0x00018cd4 <+700>: cmpib,= -1,ret0,0x18cec
<ServiceTypeDefinition::parseValue(QByteArray const&, QString const&)
const+724>
0x00018cd8 <+704>: copy r19,r4
0x00018cdc <+708>: b,l 0x22a78 <__sync_sub_and_fetch_4>,rp
0x00018ce0 <+712>: ldi 1,r25
The call at 0x00018cbc is to memcmp. When the two cmpib instructions fall
through to the call to __sync_sub_and_fetch_4, the r26 argument register is
not initialized for the call to __sync_sub_and_fetch_4.
The compilation command is:
/usr/lib/gcc/hppa-linux-gnu/7/cc1plus -fpreprocessed desktopfileparser.ii
-quiet -dumpbase desktopfileparser.cpp -auxbase-strip
CMakeFiles/desktoptojson.dir/__/lib/plugin/desktopfileparser.cpp.o -g -O2
-Wformat=1 -Werror=format-security -Wall -Wextra -Wcast-align -Wchar-subscripts
-Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor
-Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time -Wpedantic
-Wsuggest-override -std=c++11 -std=gnu++11 -version
-fdebug-prefix-map=/home/dave/debian/kcoreaddons/kcoreaddons-5.37.0=.
-fno-operator-names -fexceptions -fvisibility=hidden
-fvisibility-inlines-hidden -fPIC -o desktopfileparser.s
It appears in looking at the rtl dumps that things go bad in the dbr pass.