From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19653 invoked by alias); 15 Jun 2013 05:09:53 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19613 invoked by uid 48); 15 Jun 2013 05:09:46 -0000 From: "naruse at airemix dot jp" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/57621] New: -Og Date: Sat, 15 Jun 2013 05:09:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: naruse at airemix dot jp X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-06/txt/msg00773.txt.bz2 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 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