public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "naruse at airemix dot jp" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/57621] New: -Og Date: Sat, 15 Jun 2013 05:09:00 -0000 [thread overview] Message-ID: <bug-57621-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57621 Bug ID: 57621 Summary: -Og Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: naruse at airemix dot jp Folloing program is to verify func's argument is not larger than 3 at compile time. And this program uses valid argument 0. Threfore I want the code is compiled without error. This idea works on -O, -O1, -O2, -O3, -Os. But on -Og, it fails with attribute error. Of course it is not what I want, but is this intended behavior? % cat og.c #include <stdio.h> int ruby$safe_level$4(void) __attribute__((error("$SAFE=4 is obsolete"))); #define func(a) (__builtin_constant_p(a) && (a) > 3) ? ruby$safe_level$4() : (a) struct foo { int n; }; void show(struct foo *p) { printf("%d\n", func(p->n)); } void hoge(void) { struct foo f; f.n = 0; show(&f); } int main(void) { hoge(); return 0; } % gcc49 -O og.c && ./a.out 0 % gcc49 -Og og.c && ./a.out og.c: In function 'show': og.c:9:11: error: call to 'ruby$safe_level$4' declared with attribute error: $SAFE=4 is obsolete printf("%d\n", func(p->n)); ^ % gcc49 -v Using built-in specs. COLLECT_GCC=gcc49 COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc49/gcc/x86_64-portbld-freebsd9.1/4.9.0/lto-wrapper Target: x86_64-portbld-freebsd9.1 Configured with: ./../gcc-4.9-20130526/configure --disable-nls --libdir=/usr/local/lib/gcc49 --libexecdir=/usr/local/libexec/gcc49 --program-suffix=49 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc49/include/c++/ --with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --disable-libgcj --enable-languages=c,c++,objc,fortran --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc49 --build=x86_64-portbld-freebsd9.1 Thread model: posix gcc version 4.9.0 20130526 (experimental) (FreeBSD Ports Collection) % uname -a FreeBSD windy.airemix.net 9.1-RELEASE-p3 FreeBSD 9.1-RELEASE-p3 #0: Mon Apr 29 18:27:25 UTC 2013 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
next reply other threads:[~2013-06-15 5:09 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-06-15 5:09 naruse at airemix dot jp [this message] 2013-06-15 6:04 ` [Bug c/57621] attribute error is interpreted even if it is switched with __builtin_constant_p on -Og pinskia at gcc dot gnu.org 2013-06-16 21:12 ` hp at gcc dot gnu.org 2013-06-16 21:15 ` pinskia at gcc dot gnu.org
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 * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-57621-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).