new bounds-checking patches

Herman ten Brugge hermantenbrugge@home.nl
Fri May 6 20:16:00 GMT 2005


I just released 2 new releases for gcc-3.3.6 and gcc-4.0.0 of my 
bounds-checking patch.
The patches can be found on http://sourceforge.net/projects/boundschecking

Can some one update the extension page (http://gcc.gnu.org/extensions.html).
This page still points to http://web.inter.NL.net/hcc/Haj.Ten.Brugge/
Thanks.

When implementing bounds-checking for gcc-4.0.0  I found perhaps a small
mistake in the gimplify code. I applied the following patch:

diff -rupN -x tags -x 'c-parse.[cy]' -x 'objc-parse.[cy]' -x 
'parse.[ch]' -x '*.info*' gcc-4.0.0.org/gcc/gimplify.c 
gcc-4.0.0/gcc/gimplify.c
--- gcc-4.0.0.org/gcc/gimplify.c        2005-04-17 05:53:50.000000000 +0200
+++ gcc-4.0.0/gcc/gimplify.c    2005-05-05 17:43:00.000000000 +0200
@@ -334,7 +334,7 @@ create_tmp_var_raw (tree type, const cha
   TYPE_ATTRIBUTES (new_type) = TYPE_ATTRIBUTES (type);

   tmp_var = build_decl (VAR_DECL, prefix ? create_tmp_var_name (prefix) 
: NULL,
-                       type);
+                       new_type);

   /* The variable was declared by the compiler.  */
   DECL_ARTIFICIAL (tmp_var) = 1;

It looks like a typo. I can open a problem report is this is really a 
mistake.


I also did some performance tests. The results are below. I selected a 
random
package (openssl-0.9.7e.tar.gz) and ran the bounds-checking and mudflap
implementations with different compiler opions. This is just one random
package selection and I only wanted to show that my new inline
implementation for gcc-4.0.0 worked well when compiling with -O3.
Since mudflap is in this release as well I also did some tests there.
I could have picked the wrong testcode to compare bounds-checking
and mudflap.

    Herman.




#! /bin/sh

# gcc-4.0.0 with bounds-checking patch
#                                             compile slower             
run   slower
# normal            -O2              : 114.65    1.00            17.39   
1.00
# normal            -O3              : 119.39    1.04            17.36   
1.00
# -fbc-strings-only -O2          : 130.16    1.14            33.64   1.93
# -fbc-strings-only -O3          : 137.08    1.20            32.58   1.87
# -fbc-strings-only -O2 INL   : 130.30    1.14            34.05   1.96
# -fbc-strings-only -O3 INL   : 137.20    1.20            32.55   1.87
# -fbounds-checking -O2        : 171.28    1.49           328.29  18.88
# -fbounds-checking -O3        : 244.49    2.13           229.60  13.20
# -fbounds-checking -O2 INL : 338.90    2.96           244.59  14.06
# -fbounds-checking -O3 INL : 414.59    3.62           122.64   7.05

# gcc-4.0.0 with mudflap
#                                    compile slower            run   slower
# normal            -O2      : 115.40    1.01            18.04   1.04
# normal            -O3      : 120.34    1.05            17.50   1.01
# -fmudflap         -O2     : 338.92    2.96           206.08  11.85
# -fmudflap         -O3     : 365.52    3.19           197.00  11.33

rm -f result log log2
exec >log 2>log2

FORMAT="%U user %S system %E elapsed %P CPU"

PATH=$HOME/bounds/install/bin:$PATH

# bounds-checking
GCC_BOUNDS_OPTS="-no-message -no-statistics" ; export GCC_BOUNDS_OPTS
GCC=gcc

for i in "-O2" \
         "-O3" \
         "-fbc-strings-only -O2" \
         "-fbc-strings-only -O3" \
         "-fbc-strings-only -O2 -D__BOUNDS_INLINE__" \
         "-fbc-strings-only -O3 -D__BOUNDS_INLINE__" \
         "-fbounds-checking -O2" \
         "-fbounds-checking -O3" \
         "-fbounds-checking -O2 -D__BOUNDS_INLINE__" \
         "-fbounds-checking -O3 -D__BOUNDS_INLINE__"
do
  echo $i >> result
  gzip -cd openssl-0.9.7e.tar.gz | tar -xvf -
  cd openssl-0.9.7e
  /usr/bin/time -f "$FORMAT" -o ../result -a make CC="$GCC $i" 
CFLAG="-DOPENSSL_NO_KRB5" PERL=perl
  /usr/bin/time -f "$FORMAT" -o ../result -a make CC="$GCC $i" 
CFLAG="-DOPENSSL_NO_KRB5" PERL=perl test
  cd ..
  rm -rf openssl-0.9.7e
done

# mudflap
MUDFLAP_OPTIONS="-no-timestamps -backtrace=0"; export MUDFLAP_OPTIONS
GCC=gcc

for i in "-O2" \
         "-O3" \
         "-fmudflap -lmudflap -O2" \
         "-fmudflap -lmudflap -O3"
do
  echo $i >> result
  gzip -cd openssl-0.9.7e.tar.gz | tar -xvf -
  cd openssl-0.9.7e
  /usr/bin/time -f "$FORMAT" -o ../result -a make CC="$GCC $i" 
CFLAG="-DOPENSSL_NO_KRB5" PERL=perl
  /usr/bin/time -f "$FORMAT" -o ../result -a make CC="$GCC $i" 
CFLAG="-DOPENSSL_NO_KRB5" PERL=perl test
  cd ..
  rm -rf openssl-0.9.7e
done



More information about the Gcc mailing list