From: Jed Brown <jed@59A2.org>
To: Dirk-Jan Binnema <djcb.bulk@gmail.com>, Jed Brown <jed@59a2.org>
Cc: "notmuch@notmuchmail org" <notmuch@notmuchmail.org>,
djcb@djcbsoftware.nl
Subject: Re: [PATCH 1/2] * avoid gcc 4.4.1 compiler warnings due to ignored write return values
Date: Mon, 23 Nov 2009 17:38:42 +0100 [thread overview]
Message-ID: <87skc542nh.fsf@59A2.org> (raw)
In-Reply-To: <1873022c0911230814y783f14ffn23f12d13c73e5acc@mail.gmail.com>
On Mon, 23 Nov 2009 18:14:12 +0200, Dirk-Jan Binnema <djcb.bulk@gmail.com> wrote:
> Did you try it with -O2? Without optimizations many of the warnings are not
> issued.
Yes,
$ cat > foo.c
#include <stdlib.h>
#include <unistd.h>
int main()
{
malloc(5);
write(2,0,10);
return 0;
}
$ gcc -static -std=c89 -O0 -Wall -Wextra -pedantic -o foo foo.c
$ objdump -d -M intel foo |grep -A12 '<main>'
00000000004002a4 <main>:
4002a4: 55 push rbp
4002a5: 48 89 e5 mov rbp,rsp
4002a8: bf 05 00 00 00 mov edi,0x5
4002ad: e8 6e 61 00 00 call 406420 <__libc_malloc>
4002b2: ba 0a 00 00 00 mov edx,0xa
4002b7: be 00 00 00 00 mov esi,0x0
4002bc: bf 02 00 00 00 mov edi,0x2
4002c1: e8 ea a0 00 00 call 40a3b0 <__libc_write>
4002c6: b8 00 00 00 00 mov eax,0x0
4002cb: c9 leave
4002cc: c3 ret
4002cd: 90 nop
$ gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr --enable-shared --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-threads=posix --mandir=/usr/share/man --infodir=/usr/share/info --enable-__cxa_atexit --disable-multilib --libdir=/usr/lib --libexecdir=/usr/lib --enable-clocale=gnu --disable-libstdcxx-pch --with-tune=generic
Thread model: posix
gcc version 4.4.2 (GCC)
$ uname -a
Linux kunyang 2.6.31-ARCH #1 SMP PREEMPT Tue Nov 10 19:01:40 CET 2009 x86_64 Intel(R) Core(TM)2 Duo CPU P8700 @ 2.53GHz GenuineIntel GNU/Linux
Seems fishy.
Jed
next prev parent reply other threads:[~2009-11-23 16:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-23 6:20 [PATCH 1/2] * avoid gcc 4.4.1 compiler warnings due to ignored write return values Dirk-Jan C. Binnema
2009-11-23 7:34 ` Karl Wiberg
2009-11-23 11:11 ` Dirk-Jan Binnema
2009-11-23 13:19 ` Karl Wiberg
2009-11-23 14:24 ` Jed Brown
2009-11-23 16:14 ` Dirk-Jan Binnema
2009-11-23 16:38 ` Jed Brown [this message]
2009-12-01 15:57 ` Carl Worth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87skc542nh.fsf@59A2.org \
--to=jed@59a2.org \
--cc=djcb.bulk@gmail.com \
--cc=djcb@djcbsoftware.nl \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).