[Bug libmudflap/26864] multithreaded mudflap not working

2006-04-25 Thread pr2345 at gmail dot com


--- Comment #5 from pr2345 at gmail dot com  2006-04-25 23:29 ---
The man page/online manual also needs a small clarification.

It only mentions the libmudflap library and not libmudflapth.  I assume
a multithreaded program should link with -lmudflapth instead of -lmudflap?

Should I create a separate bug report for this, or can you take care of it
in the same one?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26864



[Bug c++/26000] New: cast from int to float violates C++ standard in non-optimized mode

2006-01-27 Thread pr2345 at gmail dot com
Platform: i686 Linux 2.6.11

gcc version:
> gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--host=i386-redhat-linux
Thread model: posix
gcc version 4.0.2 20051125 (Red Hat 4.0.2-8)

Summary:
According to the C++ standard section 5.2.9/2, the result of casting an
expression to float is as if a temporary variable of type float were 
declared and initialized with that expression, and then used in place 
of the expression.

That seems to be violated in the program below when compiled in non debug mode
(gcc test.c)  The program a.out prints 1 instead of 0.
In optimized mode (gcc -O test.c) the program prints 0 correctly.  Same thing
with -O2.

Same result when renaming the file test.cpp and compiling with g++ and also
when using static_cast instead of C-style casts.

In the program below, the functions foo1() and foo2() should always produce the
same result.  But the assembly code for foo2() differs from foo1() by two extra
lines (fstps and flds) when compiled in non-optimized mode.

test.c:

int foo1(int x)
{  
   return (int)(float)x;
}  

int foo2(int x)
{
   float f = x;
   return (int)f;
}  

int main()
{
   int i = 0x101;   /* i == 16777217 */
   int u = foo1(i) - foo2(i);
   printf("u=%d\n", u);
}


-- 
   Summary: cast from int to float violates C++ standard in non-
optimized mode
   Product: gcc
   Version: 4.0.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: pr2345 at gmail dot com
  GCC host triplet: ?


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26000



[Bug c++/26068] New: extern "C" static function should not be allowed

2006-02-01 Thread pr2345 at gmail dot com
Acccording to C++ standard 7.5/7 "A linkage-specification directly containing a
single declaration shall not specify a storage class."  They also give the
following example as invalid:

extern "C" static void foo();

But g++ version 4.0.2 accepts this.


-- 
   Summary: extern "C" static function should not be allowed
   Product: gcc
   Version: 4.0.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: pr2345 at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26068



[Bug c/26864] New: multithreaded mudflap not working

2006-03-24 Thread pr2345 at gmail dot com
gcc version: 
gcc (GCC) 4.0.2 20051125 (Red Hat 4.0.2-8)

Sample program t1.c:
int main()
{
   int a[3] = { 1, 2, 3 };
   return a[3];
}

When I compile this with mudflap, it correctly reports an error:
$ gcc -fmudflap t1.c -lmudflap
$ a.out
***
mudflap violation 1 (check/read): time=1143264091.275264 ptr=0xbf97b680 size=16
pc=0x5e8373 location=`s3.c:4 (main)'
  /usr/lib/libmudflap.so.0(__mf_check+0x44) [0x5e8373]
  a.out(main+0xa1) [0x8048751]
  /usr/lib/libmudflap.so.0(__wrap_main+0x1d8) [0x5e90be]
Nearby object 1: checked region begins 0B into and ends 4B after
mudflap object 0x8712380: name=`s3.c:3 (main) a'
bounds=[0xbf97b680,0xbf97b68b] size=12 area=stack check=3r/0w liveness=3
alloc time=1143264091.275229 pc=0x5e8e7a
number of nearby objects: 1

The manual recommends using -fmudflapth for multithreaded programs.  One thing
in the man page/online manual that is not clear is whether to link with
libmudflap or libmudflapth for multithreaded program.  Both libraries exist but
only libmudflap is mentioned in the manual.  This should be clarified.

In any case, when I link with either -lmudflap or -lmudflapth and compile with
-fmudflapth, a.out gives no output at all.

$ gcc -pthread -fmudflapth t1.c -lmudflapth
[ omitted irrelevant warnings about deprecated pthread_attr_getstackaddr ]
$ a.out
[ no output at all ]

$ gcc -pthread -fmudflapth t1.c -lmudflap
[ same ]
$ a.out
[ no output ]


-- 
   Summary: multithreaded mudflap not working
   Product: gcc
   Version: 4.0.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pr2345 at gmail dot com
 GCC build triplet: same
  GCC host triplet: Linux 2.6 i386
GCC target triplet: same


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26864