[Bug c/39808] New: warn_unused_result fails to produce warning

2009-04-18 Thread sandmann at daimi dot au dot dk
The program to be attached produces the warning

[...@dhcp-100-2-40 ~]$ gcc gb.c
gb.c: In function ‘main’:
gb.c:11: warning: ignoring return value of ‘foo’, declared with attribute
warn_unused_result

which is expected. However, it should also produce a warning for line 12, which
is exactly the same except a dummy variable is declared.



Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-cpu=generic --build=i386-redhat-linux
Thread model: posix
gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC)


-- 
   Summary: warn_unused_result fails to produce warning
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sandmann at daimi dot au dot dk
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


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



[Bug c/39808] warn_unused_result fails to produce warning

2009-04-18 Thread sandmann at daimi dot au dot dk


--- Comment #1 from sandmann at daimi dot au dot dk  2009-04-18 17:32 
---
Created an attachment (id=17654)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17654&action=view)
program


-- 


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



[Bug c/39808] warn_unused_result fails to produce warning

2009-04-22 Thread sandmann at daimi dot au dot dk


--- Comment #3 from sandmann at daimi dot au dot dk  2009-04-22 17:03 
---
Why not? If not using the return value is a bug, then it's also a bug if it
isn't used after being passed through a statement expression.


-- 


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



[Bug c/34384] New: Poor code generated when passing returned struct as a parameter

2007-12-07 Thread sandmann at daimi dot au dot dk
The program I will attach has a function that returns a struct. This struct is
then immediately passed by value to another function.

The code generated is using a local temporary variable, which leads to this
code:

   (1) load address of temporary into eax
   (2) call fun2(), which then fills out the temporary
   (3) push temporary on stack
   (4) call fun1()

It would be better to generate this:

   (1) reserve space on stack for temporary
   (2) move pointer to temporary into eax
   (3) call fun2(), which fills out the temporary
   (4) call fun1(), with the temporary already available on the stack


-- 
   Summary: Poor code generated when passing returned struct as a
parameter
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sandmann at daimi dot au dot dk
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


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



[Bug c/34384] Poor code generated when passing returned struct as a parameter

2007-12-07 Thread sandmann at daimi dot au dot dk


--- Comment #1 from sandmann at daimi dot au dot dk  2007-12-07 22:00 
---
Created an attachment (id=14709)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14709&action=view)
Program using struct returns and parameters


-- 


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



[Bug target/34384] Poor code generated when passing returned struct as a parameter

2007-12-16 Thread sandmann at daimi dot au dot dk


--- Comment #3 from sandmann at daimi dot au dot dk  2007-12-16 22:29 
---
[EMAIL PROTECTED] ~]$ 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-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-cpu=generic
--host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)


-- 


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