This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[mudflap] pr 21023


Hi -

As the bug reporter suspected, !TREE_PUBLIC seems to work
better than TREE_STATIC in that particular expression.

 2005-06-14  Frank Ch. Eigler  <fche@redhat.com>

       PR mudflap/21023
       * tree-mudflap.c (mudflap_finish_file): Exclude non-public
       rather than static objects (!) from libmudflap registration.

       * testsuite/libmudflap.c/externs.exp, externs-{1,2}.c: New test files.
       * testsuite/libmudflap.c/cfrags.exp: Bypass new sources.


Index: gcc/tree-mudflap.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-mudflap.c,v
retrieving revision 2.43
diff -w -p -s -r2.43 tree-mudflap.c
*** gcc/tree-mudflap.c  7 Jun 2005 12:01:27 -0000       2.43
--- gcc/tree-mudflap.c  14 Jun 2005 19:06:19 -0000
*************** mudflap_finish_file (void)
*** 1257,1263 ****
               Perform registration for non-static objects regardless of
               TREE_USED or TREE_ADDRESSABLE, because they may be used
               from other compilation units.  */
!           if (TREE_STATIC (obj) && ! TREE_ADDRESSABLE (obj))
              continue;

            if (! COMPLETE_TYPE_P (TREE_TYPE (obj)))
--- 1257,1263 ----
               Perform registration for non-static objects regardless of
               TREE_USED or TREE_ADDRESSABLE, because they may be used
               from other compilation units.  */
!           if (! TREE_PUBLIC (obj) && ! TREE_ADDRESSABLE (obj))
              continue;

            if (! COMPLETE_TYPE_P (TREE_TYPE (obj)))



Index: libmudflap/testsuite/libmudflap.c/cfrags.exp
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/testsuite/libmudflap.c/cfrags.exp,v
retrieving revision 1.4
diff -w -p -s -r1.4 cfrags.exp
*** libmudflap/testsuite/libmudflap.c/cfrags.exp        4 Jun 2004 20:12:01 -0000       1.4
--- libmudflap/testsuite/libmudflap.c/cfrags.exp        14 Jun 2005 19:06:19 -0000
*************** dg-init
*** 5,11 ****

  global srcdir
  foreach flags [list {} {-static} {-O2} {-O3}] {
!     foreach srcfile [lsort [glob -nocomplain ${srcdir}/libmudflap.c/*.c]] {
        set bsrc [file tail $srcfile]
        setenv MUDFLAP_OPTIONS "-viol-segv"
        dg-runtest $srcfile $flags "-fmudflap -lmudflap"
--- 5,15 ----

  global srcdir
  foreach flags [list {} {-static} {-O2} {-O3}] {
!     foreach srcfile [lsort [glob -nocomplain \
!                             ${srcdir}/libmudflap.c/*frag.c \
!                             ${srcdir}/libmudflap.c/heap*.c \
!                             ${srcdir}/libmudflap.c/hook*.c \
!                             ${srcdir}/libmudflap.c/pass*.c]] {
        set bsrc [file tail $srcfile]
        setenv MUDFLAP_OPTIONS "-viol-segv"
        dg-runtest $srcfile $flags "-fmudflap -lmudflap"
Index: libmudflap/testsuite/libmudflap.c/externs-1.c
===================================================================
RCS file: libmudflap/testsuite/libmudflap.c/externs-1.c
diff -N libmudflap/testsuite/libmudflap.c/externs-1.c
*** /dev/null   1 Jan 1970 00:00:00 -0000
--- libmudflap/testsuite/libmudflap.c/externs-1.c       14 Jun 2005 19:06:19 -0000
***************
*** 0 ****
--- 1,14 ----
+ typedef struct { char *name; } dummy;
+ extern dummy d[];
+
+ int
+ main (void)
+ {
+   dummy *pd = d;
+
+   while (pd->name)
+     {
+       printf ("%s\n", pd->name);
+       pd++;
+     }
+ }
Index: libmudflap/testsuite/libmudflap.c/externs-2.c
===================================================================
RCS file: libmudflap/testsuite/libmudflap.c/externs-2.c
diff -N libmudflap/testsuite/libmudflap.c/externs-2.c
*** /dev/null   1 Jan 1970 00:00:00 -0000
--- libmudflap/testsuite/libmudflap.c/externs-2.c       14 Jun 2005 19:06:19 -0000
***************
*** 0 ****
--- 1,2 ----
+ typedef struct { char *name; } dummy;
+ dummy d[] = { {"a"}, {0} };
Index: libmudflap/testsuite/libmudflap.c/externs.exp
===================================================================
RCS file: libmudflap/testsuite/libmudflap.c/externs.exp
diff -N libmudflap/testsuite/libmudflap.c/externs.exp
*** /dev/null   1 Jan 1970 00:00:00 -0000
--- libmudflap/testsuite/libmudflap.c/externs.exp       14 Jun 2005 19:06:19 -0000
***************
*** 0 ****
--- 1,40 ----
+ libmudflap-init c
+ dg-init
+
+ global srcdir subdir
+
+ foreach flags [list {} {-static} {-O2} {-O3}] {
+     set l1 [libmudflap_target_compile "$srcdir/$subdir/externs-1.c" "externs-1.o" object {additional_flags=-fmudflap}]
+     set test "externs-1 compilation ${flags}"
+     if [string match "*mudflap cannot track unknown size extern *d*" $l1] { pass $test } { fail $test }
+
+     set l2 [libmudflap_target_compile "$srcdir/$subdir/externs-2.c" "externs-2.o" object {additional_flags=-fmudflap}]
+     set test "externs-2 compilation ${flags}"
+     if [string match "" $l2]  { pass $test } { fail $test }
+
+     set l3 [libmudflap_target_compile "externs-1.o externs-2.o" "externs-12.exe" executable {additional_flags=-fmudflap additional_flags=-lmudflap}]
+     set test "externs-12 linkage ${flags}"
+     if [string match "" $l3]  { pass $test } { fail $test }
+
+     set l4 [libmudflap_target_compile "externs-2.o externs-1.o" "externs-21.exe" executable {additional_flags=-fmudflap additional_flags=-lmudflap}]
+     set test "externs-21 linkage ${flags}"
+     if [string match "" $l3]  { pass $test } { fail $test }
+
+     setenv MUDFLAP_OPTIONS "-viol-segv"
+
+     remote_spawn host "./externs-12.exe"
+     set l5 [remote_wait host 10]
+     set test "externs-12 execution ${flags}"
+     if {[lindex $l5 0] == 0}  { pass $test } { fail $test }
+
+     remote_spawn host "./externs-21.exe"
+     set l6 [remote_wait host 10]
+     set test "externs-21 execution ${flags}"
+     if {[lindex $l6 0] == 0}  { pass $test } { fail $test }
+
+     foreach f [glob -nocomplain "externs-*"] {
+        remote_file build delete $f
+     }
+ }
+


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]