Miscompilation with "-fpeel-loops" and -O{2,3,s}

Marcin Mirosław marcin at mejor.pl
Tue Oct 22 14:11:04 MSK 2013


Hi!
I'm not sure if it's problem inside udns or inside gcc. I'm starting to
ask here about it, if it's not problem in udns I'll look for help on gcc
mailing list.
I've noticed that compiling udns-0.2 using "-fpeel-loops" optimalization
(togoether with -O2, -O3 or -Os) build executable which doesn't works
correctly.
Without -fpeel-loops:
$ ./rblcheck -s rbl.mejor.pl 88.198.102.195 ; echo  $?
88.198.102.195 is listed by rbl.mejor.pl: 127.0.1.1
100

with -fpeel-loops:
$ ./rblcheck -s rbl.mejor.pl 88.198.102.195 ; echo $?
0

Also I'm using jabberd2 which uses libudns, when udns is compiled with
-fpeel-loops jabberd2 can't connect to most of jabber servers
(especially with gmail.com). I suspect problem appears when records AAAA
appears in response but I didn't make investigation.
I also suspect problem appears while ocmpiling udns_resolver.c, I did
some tests, when udns_resolver.o was compiled with -fpeel-loops then
after linking libudns didn't work correctly.
I have no more skills to find out where is problem (gcc or udns). I
prepared static clang analyse of udns[1], clang states there could be
"use-after-free" error in udns_resolver.c, can it be related to mine
problem?
Reagrds,
Marcin

[1] - http://mejor.pl/clang-analysis/udns-0.2/


More information about the udns mailing list