public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/57621] New: -Og
@ 2013-06-15  5:09 naruse at airemix dot jp
  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
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: naruse at airemix dot jp @ 2013-06-15  5:09 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/57621] attribute error is interpreted even if it is switched with __builtin_constant_p on -Og
  2013-06-15  5:09 [Bug c/57621] New: -Og naruse at airemix dot jp
@ 2013-06-15  6:04 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-06-15  6:04 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/57621] attribute error is interpreted even if it is switched with __builtin_constant_p on -Og
  2013-06-15  5:09 [Bug c/57621] New: -Og naruse at airemix dot jp
  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
  2 siblings, 0 replies; 4+ messages in thread
From: hp at gcc dot gnu.org @ 2013-06-16 21:12 UTC (permalink / raw)
  To: gcc-bugs

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

Hans-Peter Nilsson <hp at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hp at gcc dot gnu.org,
                   |                            |pinskia at gcc dot gnu.org

--- Comment #2 from Hans-Peter Nilsson <hp at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> Dup.

I presume you refer to PR56977?
Shouldn't this be marked resolved/duplicate, then, instead of resolved/fixed?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/57621] attribute error is interpreted even if it is switched with __builtin_constant_p on -Og
  2013-06-15  5:09 [Bug c/57621] New: -Og naruse at airemix dot jp
  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
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-06-16 21:15 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |DUPLICATE

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Hans-Peter Nilsson from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > Dup.
> 
> I presume you refer to PR56977?
> Shouldn't this be marked resolved/duplicate, then, instead of resolved/fixed?

That was my browser's fault it seems.  I wanted to mark it as a dup but somehow
it did not do that.

*** This bug has been marked as a duplicate of bug 56977 ***


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-16 21:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-15  5:09 [Bug c/57621] New: -Og naruse at airemix dot jp
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

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).