public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 58846
@ 2014-01-29 15:16 Paolo Carlini
  2014-01-29 16:54 ` Jason Merrill
  2014-02-04  9:55 ` Rainer Orth
  0 siblings, 2 replies; 4+ messages in thread
From: Paolo Carlini @ 2014-01-29 15:16 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 247 bytes --]

Hi,

a very minor ICE on invalid regression, but since we explicitly allow 
for redeclarations (also see comments in declare_global_var) we may as 
well avoid crashing, at least in mainline. Tested x86_64-linux.

Thanks,
Paolo.

/////////////////

[-- Attachment #2: CL_58846 --]
[-- Type: text/plain, Size: 274 bytes --]

/cp
2014-01-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58846
	* decl.c (get_dso_handle_node): Don't crash if dso_handle_node
	== error_mark_node.

/testsuite
2014-01-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58846
	* g++.dg/init/dso_handle2.C: New.

[-- Attachment #3: patch_58846 --]
[-- Type: text/plain, Size: 936 bytes --]

Index: cp/decl.c
===================================================================
--- cp/decl.c	(revision 207234)
+++ cp/decl.c	(working copy)
@@ -6709,8 +6709,11 @@ get_dso_handle_node (void)
 					ptr_type_node);
 
 #ifdef HAVE_GAS_HIDDEN
-  DECL_VISIBILITY (dso_handle_node) = VISIBILITY_HIDDEN;
-  DECL_VISIBILITY_SPECIFIED (dso_handle_node) = 1;
+  if (dso_handle_node != error_mark_node)
+    {
+      DECL_VISIBILITY (dso_handle_node) = VISIBILITY_HIDDEN;
+      DECL_VISIBILITY_SPECIFIED (dso_handle_node) = 1;
+    }
 #endif
 
   return dso_handle_node;
Index: testsuite/g++.dg/init/dso_handle2.C
===================================================================
--- testsuite/g++.dg/init/dso_handle2.C	(revision 0)
+++ testsuite/g++.dg/init/dso_handle2.C	(working copy)
@@ -0,0 +1,10 @@
+// PR c++/58846
+
+extern "C" { char* __dso_handle; }
+
+struct A
+{
+  ~A();
+};
+
+A a;  // { dg-error "conflicting declaration" }

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

* Re: [C++ Patch] PR 58846
  2014-01-29 15:16 [C++ Patch] PR 58846 Paolo Carlini
@ 2014-01-29 16:54 ` Jason Merrill
  2014-02-04  9:55 ` Rainer Orth
  1 sibling, 0 replies; 4+ messages in thread
From: Jason Merrill @ 2014-01-29 16:54 UTC (permalink / raw)
  To: Paolo Carlini, gcc-patches

OK.

Jason

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

* Re: [C++ Patch] PR 58846
  2014-01-29 15:16 [C++ Patch] PR 58846 Paolo Carlini
  2014-01-29 16:54 ` Jason Merrill
@ 2014-02-04  9:55 ` Rainer Orth
  2014-02-04 10:17   ` Paolo Carlini
  1 sibling, 1 reply; 4+ messages in thread
From: Rainer Orth @ 2014-02-04  9:55 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: gcc-patches, Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 773 bytes --]

Paolo Carlini <paolo.carlini@oracle.com> writes:

> a very minor ICE on invalid regression, but since we explicitly allow for
> redeclarations (also see comments in declare_global_var) we may as well
> avoid crashing, at least in mainline. Tested x86_64-linux.

The test FAILs on Solaris which doesn't have __cxa_atexit:

FAIL: g++.dg/init/dso_handle2.C -std=c++98  (test for errors, line 10)
FAIL: g++.dg/init/dso_handle2.C -std=c++11  (test for errors, line 10)

Fixed like dso_handle1.C does by forcing -fuse-cxa-atexit.

Tested with the appropriate runtest invocations on i386-pc-solaris2.11
and x86_64-unknown-linux-gnu.  Ok for mainline?

	Rainer


2014-02-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* g++.dg/init/dso_handle2.C: Compile with -fuse-cxa-atexit.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: testsuite-dso_handle2.patch --]
[-- Type: text/x-patch, Size: 489 bytes --]

# HG changeset patch
# Parent 944218077f384619dcc391f55c51e5ba477dd022
Fix g++.dg/init/dso_handle2.C on Solaris

	gcc/testsuite:
	* g++.dg/init/dso_handle2.C: Compile with -fuse-cxa-atexit.

diff --git a/gcc/testsuite/g++.dg/init/dso_handle2.C b/gcc/testsuite/g++.dg/init/dso_handle2.C
--- a/gcc/testsuite/g++.dg/init/dso_handle2.C
+++ b/gcc/testsuite/g++.dg/init/dso_handle2.C
@@ -1,4 +1,5 @@
 // PR c++/58846
+// { dg-options "-fuse-cxa-atexit" }
 
 extern "C" { char* __dso_handle; }
 

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]


-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

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

* Re: [C++ Patch] PR 58846
  2014-02-04  9:55 ` Rainer Orth
@ 2014-02-04 10:17   ` Paolo Carlini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Carlini @ 2014-02-04 10:17 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches, Jason Merrill

Hi,

On 02/04/2014 10:55 AM, Rainer Orth wrote:
> Paolo Carlini <paolo.carlini@oracle.com> writes:
>
>> a very minor ICE on invalid regression, but since we explicitly allow for
>> redeclarations (also see comments in declare_global_var) we may as well
>> avoid crashing, at least in mainline. Tested x86_64-linux.
> The test FAILs on Solaris which doesn't have __cxa_atexit:
>
> FAIL: g++.dg/init/dso_handle2.C -std=c++98  (test for errors, line 10)
> FAIL: g++.dg/init/dso_handle2.C -std=c++11  (test for errors, line 10)
>
> Fixed like dso_handle1.C does by forcing -fuse-cxa-atexit.
>
> Tested with the appropriate runtest invocations on i386-pc-solaris2.11
> and x86_64-unknown-linux-gnu.  Ok for mainline?
I think it qualifies at obvious. Thanks!

Paolo.

PS: At some point I had it, when I adapted the testcase from an existing 
one, then I tried to minimize it ;-/

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

end of thread, other threads:[~2014-02-04 10:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-29 15:16 [C++ Patch] PR 58846 Paolo Carlini
2014-01-29 16:54 ` Jason Merrill
2014-02-04  9:55 ` Rainer Orth
2014-02-04 10:17   ` Paolo Carlini

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