[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #10259 [Tor]: gcc 4.8 with CFLAGS=-Os generates infinite loop in smartlist_ensure_capacity()



#10259: gcc 4.8 with CFLAGS=-Os generates infinite loop in
smartlist_ensure_capacity()
--------------------------+--------------------------------
     Reporter:  zougloub  |      Owner:  nick
         Type:  defect    |     Status:  new
     Priority:  normal    |  Milestone:
    Component:  Tor       |    Version:  Tor: 0.2.5.1-alpha
   Resolution:            |   Keywords:  compiler
Actual Points:            |  Parent ID:
       Points:            |
--------------------------+--------------------------------

Comment (by zougloub):

 Checked what -Os does compared to -O2:
 {{{
 gcc -O2 -Q --help=optimizers > a
 gcc -Os -Q --help=optimizers > b
 diff -U0 a b
 }}}
 This gives:
 {{{
 --- a
 +++ b
 -  -finline-functions                   [disabled]
 +  -finline-functions                   [enabled]
 -  -foptimize-strlen                    [enabled]
 +  -foptimize-strlen                    [disabled]
 }}}

 Blind tested the compilation flags:
 {{{
 tests=(
  "-O2"
  "-O2 -finline-functions"
  "-O2 -fno-optimize-strlen"
  "-O2 -finline-functions -fno-optimize-strlen"
  "-Os"
  "-Os -fno-inline-functions"
  "-Os -foptimize-strlen"
  "-Os -fno-inline-functions -foptimize-strlen"
 )

 for x in "${tests[@]}";
 do
   echo -n "Compilation with ${x}..."
   ./configure CFLAGS="$x" >/dev/null
   make clean >/dev/null
   make >/dev/null 2>&1
   cp src/or/tor "tor $x"
   echo "OK"
 done

 for x in "${tests[@]}";
 do
   echo "Starting check of $x"
   gdb "tor $x" -ex "disas smartlist_ensure_capacity" -ex q \
    | perl -ne 'print if /<\+(\d+)>.*jmp.*smartlist_ensure_capacity\+\1/'
   ./"tor $x" -f ~/.tor/rc --runasdaemon 0 &
   sleep 3
   kill %1
   echo "Finished check of $x"
 done
 }}}

 Results: the above lags after -Os do not matter, there's always an
 infinite loop when -Os is involved here.
 There's something more than these 2 flags... "gcc -Q --help=optimizers" is
 not helping much.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/10259#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs