public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60565] New: Bogus not-in-scope error
@ 2014-03-18 13:22 patrick at parcs dot ath.cx
  2014-03-18 13:24 ` [Bug c++/60565] " patrick at parcs dot ath.cx
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: patrick at parcs dot ath.cx @ 2014-03-18 13:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60565
           Summary: Bogus not-in-scope error
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at parcs dot ath.cx

The following file fails to compile due to a bogus not-in-scope error for
B::foo ():

namespace A
{
    extern "C" void foo () throw ();
}

namespace B
{
    extern "C" void foo ();
}

int
main ()
{
    foo ();
}



$ g++ -c exc.C
exc.C:8:26: warning: declaration of ‘void B::foo()’ with C language linkage
[enabled by default]
     extern "C" void foo ();
                          ^
exc.C:3:21: warning: conflicts with previous declaration ‘void A::foo()’
[enabled by default]
     extern "C" void foo () throw ();
                     ^
exc.C:8:26: warning: due to different exception specifications [enabled by
default]
     extern "C" void foo ();
                          ^
exc.C: In function ‘int main()’:
exc.C:14:5: error: ‘foo’ is not a member of ‘B’
     B::foo ();
     ^
exc.C:14:5: note: suggested alternative:
exc.C:3:21: note:   ‘A::foo’
     extern "C" void foo () throw ();
                     ^
>From gcc-bugs-return-446706-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Mar 18 13:22:45 2014
Return-Path: <gcc-bugs-return-446706-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 13677 invoked by alias); 18 Mar 2014 13:22:45 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 13615 invoked by uid 48); 18 Mar 2014 13:22:41 -0000
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/60128] [4.8/4.9 Regression] Wrong ouput using en edit descriptor
Date: Tue, 18 Mar 2014 13:22:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dominiq at lps dot ens.fr
X-Bugzilla-Status: REOPENED
X-Bugzilla-Priority: P4
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.8.3
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-60128-4-f6zalskFgK@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60128-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60128-4@http.gcc.gnu.org/bugzilla/>
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: 2014-03/txt/msg01575.txt.bz2
Content-length: 339

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`128

--- Comment #21 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> We can xfail the test case if we are certain of the problem.

What I don't see is how to xfail only some tests for real(16). Anyway, Rainer
could open a new PR for the solaris issue and close this one as FIXED?


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

* [Bug c++/60565] Bogus not-in-scope error
  2014-03-18 13:22 [Bug c++/60565] New: Bogus not-in-scope error patrick at parcs dot ath.cx
@ 2014-03-18 13:24 ` patrick at parcs dot ath.cx
  2014-03-18 13:33 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: patrick at parcs dot ath.cx @ 2014-03-18 13:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from patrick at parcs dot ath.cx ---
Er, sorry, the call to "foo ()" within main ought to be "B::foo ()".


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

* [Bug c++/60565] Bogus not-in-scope error
  2014-03-18 13:22 [Bug c++/60565] New: Bogus not-in-scope error patrick at parcs dot ath.cx
  2014-03-18 13:24 ` [Bug c++/60565] " patrick at parcs dot ath.cx
@ 2014-03-18 13:33 ` redi at gcc dot gnu.org
  2014-03-18 14:12 ` patrick at parcs dot ath.cx
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-18 13:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to patrick from comment #0)
> $ g++ -c exc.C
> exc.C:8:26: warning: declaration of ‘void B::foo()’ with C language linkage
> [enabled by default]
>      extern "C" void foo ();
>                           ^
> exc.C:3:21: warning: conflicts with previous declaration ‘void A::foo()’
> [enabled by default]
>      extern "C" void foo () throw ();
>                      ^
> exc.C:8:26: warning: due to different exception specifications [enabled by
> default]
>      extern "C" void foo ();
>                           ^

This inconsistency makes the declaration of B::foo() ill-formed.


> exc.C: In function ‘int main()’:
> exc.C:14:5: error: ‘foo’ is not a member of ‘B’
>      B::foo ();
>      ^

This does not correspond to the code above, I don't know whether the code or
the error is what you mean to post.

In either case, I don't think this is bogus. The function's name is "foo" for
linkage purposes, but as it isn't declared in the global namespace you still
need to qualify it to call it. If you call A::foo() it will compile, or if you
fix the ill-formed redeclaration as B::foo() then you can call it as B::foo().
You cannot call it unqualified though (unless you add a using declaration or
using directive or redeclare it at global scope).
>From gcc-bugs-return-446712-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Mar 18 13:37:52 2014
Return-Path: <gcc-bugs-return-446712-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 27974 invoked by alias); 18 Mar 2014 13:37:52 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 27928 invoked by uid 48); 18 Mar 2014 13:37:47 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60565] Bogus not-in-scope error
Date: Tue, 18 Mar 2014 13:37:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
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: redi at gcc dot gnu.org
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:
Message-ID: <bug-60565-4-KYAg4TQ27x@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60565-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60565-4@http.gcc.gnu.org/bugzilla/>
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: 2014-03/txt/msg01581.txt.bz2
Content-length: 462

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`565

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to patrick from comment #1)
> Er, sorry, the call to "foo ()" within main ought to be "B::foo ()".

OK, in that case you need to fix the declaration of B::foo() if you want to
call it.  I think G++ is ignoring the inconsistent declaration of B::foo(). I'm
not sure if that's correct, or whether it should give an error at that point.


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

* [Bug c++/60565] Bogus not-in-scope error
  2014-03-18 13:22 [Bug c++/60565] New: Bogus not-in-scope error patrick at parcs dot ath.cx
  2014-03-18 13:24 ` [Bug c++/60565] " patrick at parcs dot ath.cx
  2014-03-18 13:33 ` redi at gcc dot gnu.org
@ 2014-03-18 14:12 ` patrick at parcs dot ath.cx
  2014-03-18 15:47 ` redi at gcc dot gnu.org
  2021-07-28 15:54 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: patrick at parcs dot ath.cx @ 2014-03-18 14:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from patrick at parcs dot ath.cx ---
(In reply to Jonathan Wakely from comment #3)
> (In reply to patrick from comment #1)
> > Er, sorry, the call to "foo ()" within main ought to be "B::foo ()".
> 
> OK, in that case you need to fix the declaration of B::foo() if you want to
> call it.  I think G++ is ignoring the inconsistent declaration of B::foo().
> I'm not sure if that's correct, or whether it should give an error at that
> point.

I think the compiler should not ignore the ill-formed declaration because 1)
the diagnostic emitted is just a warning and 2) acknowledging the declaration
even though it is ill-formed is consistent with the behavior of the following
test case:


namespace A
{
    extern "C" void foo (int);
}

namespace B
{
    extern "C" void foo ();
}

int
main ()
{
    B::foo ();
}

$ g++ -c exc.c
exc.C:9:29: warning: declaration of ‘void B::foo(int)’ with C language linkage
[enabled by default]
     extern "C" void foo (int);
                             ^
exc.C:3:21: warning: conflicts with previous declaration ‘void A::foo()’
[enabled by default]
     extern "C" void foo ();
                     ^

Here, a much more egregious bug may have been introduced yet the the second
ill-formed declaration is still usable.
>From gcc-bugs-return-446717-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Mar 18 14:23:47 2014
Return-Path: <gcc-bugs-return-446717-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 2118 invoked by alias); 18 Mar 2014 14:23:47 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 2075 invoked by uid 48); 18 Mar 2014 14:23:42 -0000
From: "ramana at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/60459] Crash seen in _Unwind_VRS_Pop() for ARM platform
Date: Tue, 18 Mar 2014 14:23:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.2.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: critical
X-Bugzilla-Who: ramana at gcc dot gnu.org
X-Bugzilla-Status: WAITING
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:
Message-ID: <bug-60459-4-PWMhgGOvoo@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60459-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60459-4@http.gcc.gnu.org/bugzilla/>
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: 2014-03/txt/msg01586.txt.bz2
Content-length: 2465

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`459

--- Comment #4 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
(In reply to Raghu from comment #3)
> (In reply to Andrew Pinski from comment #1)
> > Can you try a newer version than GCC 4.2.1?
> >
> > Also can you provide the exact options you compiled your source with?  And
> > the exact configure options you configured GCC with?
>
> Hi,
>
> I am using the GCC which we got from the toolchain for ARM target.
> Below are config options with which GCC was configured.
>
> ./gcc -B./ -v
> Using built-in specs.
> Target: arm-linux-uclibcgnueabi
> Configured with:
> /home/ben/Katalix/toolchain/arm-toolchain/stb_toolchain_2.1/
> toolchain_build_arm_nofpu/gcc-4.2.1/configure --prefix=/usr
> --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu
> --target=arm-linux-uclibcgnueabi --enable-languages=c,c++
> --with-sysroot=/opt/toolchains/tools-4.2.1-arm9
> --with-build-time-tools=/opt/toolchains/tools-4.2.1-arm9/usr/arm-linux-
> uclibcgnueabi/bin --disable-__cxa_atexit --enable-target-optspace
> --with-gnu-ld --enable-shared
> --with-gmp=/home/ben/Katalix/toolchain/arm-toolchain/stb_toolchain_2.1/
> toolchain_build_arm_nofpu/gmp
> --with-mpfr=/home/ben/Katalix/toolchain/arm-toolchain/stb_toolchain_2.1/
> toolchain_build_arm_nofpu/mpfr --disable-nls --enable-threads
> --enable-multilib --with-float=soft --with-tune=arm920t
> Thread model: posix
> gcc version 4.2.1
>
>
> Please advice if the above configure options are correct?

Looks sane to me - depends on what you want to do.

>
> Any thoughts why the crash in _Unwind_VRS_Pop() is seen?
>

No idea, search in the archives and any bug reports or look at changes in the
files. It's such an old toolchain and there have been tons of changes since
that it is difficult for someone to work out what's going on and what the issue
might be.

Without a small testcase that shows the problem, to see whether the crash
happens with a more recent toolchain not many folks are going to be able to
support you further.


> We don't have another version of ARM toolchain. Is there any stable prebuild
> toolchain for ARM platform to use?
>

There are some that are available if you google for it.
https://launchpad.net/gcc-arm-embedded might help you but YMMV if you want to
target arm9's by default.

Changing the priority won't help when you haven't followed instructions as you
have been asked to from commnent #c2

Ramana

> Thanks,
> Raghu


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

* [Bug c++/60565] Bogus not-in-scope error
  2014-03-18 13:22 [Bug c++/60565] New: Bogus not-in-scope error patrick at parcs dot ath.cx
                   ` (2 preceding siblings ...)
  2014-03-18 14:12 ` patrick at parcs dot ath.cx
@ 2014-03-18 15:47 ` redi at gcc dot gnu.org
  2021-07-28 15:54 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-18 15:47 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-03-18
     Ever confirmed|0                           |1

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes, the current behaviour is certainly not consistent.

Clang warns about the missing exception-specification but allows B::foo() to be
called, as you expect.


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

* [Bug c++/60565] Bogus not-in-scope error
  2014-03-18 13:22 [Bug c++/60565] New: Bogus not-in-scope error patrick at parcs dot ath.cx
                   ` (3 preceding siblings ...)
  2014-03-18 15:47 ` redi at gcc dot gnu.org
@ 2021-07-28 15:54 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-28 15:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60565

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |8.0
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |8.0
           Keywords|                            |rejects-valid
         Resolution|---                         |FIXED

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This works in GCC 8 and above.

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

end of thread, other threads:[~2021-07-28 15:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-18 13:22 [Bug c++/60565] New: Bogus not-in-scope error patrick at parcs dot ath.cx
2014-03-18 13:24 ` [Bug c++/60565] " patrick at parcs dot ath.cx
2014-03-18 13:33 ` redi at gcc dot gnu.org
2014-03-18 14:12 ` patrick at parcs dot ath.cx
2014-03-18 15:47 ` redi at gcc dot gnu.org
2021-07-28 15:54 ` 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).