[Patch] PR tree-optimization/100081 - Limit depth of logical expression windback.

2021-04-17 Thread Andrew MacLeod via Gcc-patches
The code presented at the time wrestrict was invoking ranger has a basic 
block with about 7200 statements, all of them calculations which fed 
into 2614 logical ORs and 1480 logical ANDs.


the GORI component which calculates outgoing ranges starts at the exit 
of the block and works it way back  thru the basic block to the ssa_name 
requested, solving the equations along the way.


Logical expressions require a TRUE and FALSE results to be calculated 
for the ssa_name for each of two condition register operands on the 
logical expression.  Sometimes we can shortcut it, but frequently it its 
requires all 4 to properly evaluate.


When logical operations feed each other, this can become exponential.. 
and that was the situation here.


We had introduced a logical cache to attempt to reduce the number of 
calculations, but it was insufficient.  We had previously discussed 
among ourselves that limiting the depth was probably suifficient, since 
the odds of being able to extract a meaningful range thru a large series 
of logical operations becomes highly unlikely.


THis patch implements the depth limiter for logical statements and sets 
it at  6.  so more than 6 logical statements feeding each other, and we 
decide its not worth looking back any further and say this edge does not 
compute a range.


This passes bootstrap and regression testing on x86_64-pc-linux-gnu.  I 
also ran it against the unlimited depth version on a full set of GCC 
source files, and there was 0 difference between this and the original.


I also disable the logical cache since it isn't really doing anything 
any more.


 OK for trunk?

Andrew


PS. first mail from a new mailer system...  hopefully it formats ok..


commit 9d04ed1ca8c2acddd89a398d0dd96e3924dd15cb
Author: Andrew MacLeod 
Date:   Fri Apr 16 17:08:51 2021 -0400

Limit depth of logical expression windback.

Limit how many exponentially expanded logical expressions GORI will look
back thru when evaluating outgoing edge range.

PR tree-optimization/100081
* gimple-range-cache.h (ranger_cache): Inherit from gori_compute
not gori_compute_cache.
* gimple_range_gori.cc (gori_compute::gori_compute): Initialize
m_logical_depth.
(gori_compute::compute_logical_operands): Limit depth to 6.
* gimple_range_gori.h (gori_compute): Add m_logical_depth member.

diff --git a/gcc/gimple-range-cache.h b/gcc/gimple-range-cache.h
index c98e9871734..2b36a02654b 100644
--- a/gcc/gimple-range-cache.h
+++ b/gcc/gimple-range-cache.h
@@ -87,7 +87,7 @@ private:
 // them available for gori-computes to query so outgoing edges can be
 // properly calculated.
 
-class ranger_cache : public gori_compute_cache
+class ranger_cache : public gori_compute
 {
 public:
   ranger_cache (class gimple_ranger );
diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index 7f7f3dc0d69..6e0bd0fe6a5 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -464,6 +464,7 @@ gori_compute::gori_compute ()
   if (bb)
m_gori_map->exports (bb);
 }
+  m_logical_depth =  0;
 }
 
 // Destruct a gori_compute_object.
@@ -851,6 +852,9 @@ gori_compute::compute_logical_operands_in_chain (tf_range 
,
 expr_range_in_bb (range.false_range, name, bb);
 }
 
+// Set the maximum depth we will analyze logical combinations.
+#define LOGICAL_LIMIT  6
+
 // Given a logical STMT, calculate true and false for each potential
 // path using NAME, and resolve the outcome based on the logical
 // operator.
@@ -875,11 +879,17 @@ gori_compute::compute_logical_operands (irange , gimple 
*stmt,
   if (!op1_in_chain && !op2_in_chain)
 return false;
 
+  if (m_logical_depth > LOGICAL_LIMIT)
+return false;
+  m_logical_depth++;
+
   tf_range op1_range, op2_range;
   compute_logical_operands_in_chain (op1_range, stmt, lhs,
 name, op1, op1_in_chain);
   compute_logical_operands_in_chain (op2_range, stmt, lhs,
 name, op2, op2_in_chain);
+  m_logical_depth--;
+
   return logical_combine (r, gimple_expr_code (stmt), lhs,
  op1_range, op2_range);
 }
diff --git a/gcc/gimple-range-gori.h b/gcc/gimple-range-gori.h
index 48c746d1f37..513c0acd11f 100644
--- a/gcc/gimple-range-gori.h
+++ b/gcc/gimple-range-gori.h
@@ -94,6 +94,7 @@ protected:
const class tf_range _range);
   int_range<2> m_bool_zero;   // Boolean false cached.
   int_range<2> m_bool_one;// Boolean true cached.
+  int m_logical_depth;
 
 private:
   bool compute_operand_range_switch (irange , gswitch *stmt,


[Patch, fortran] PR fortran/100132 - Optimization breaks pointer association

2021-04-17 Thread José Rui Faustino de Sousa via Gcc-patches

Hi All!

Proposed patch to:

PR100132 - Optimization breaks pointer association.

Patch tested only on x86_64-pc-linux-gnu.

Correct pointer attributes when passing polymorphic pointers.

Thank you very much.

Best regards,
José Rui

Fortran: Fix function attributes [PR100132]

gcc/fortran/ChangeLog:

PR fortran/100132
* trans-types.c (create_fn_spec): fix function attributes when
passing polymorphic pointers.

gcc/testsuite/ChangeLog:

PR fortran/100132
* gfortran.dg/PR100132.f90: New test.

diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 9f21b3ee780..6cf85dc9a41 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -2981,12 +2981,25 @@ create_fn_spec (gfc_symbol *sym, tree fntype)
   for (f = gfc_sym_get_dummy_args (sym); f; f = f->next)
 if (spec_len < sizeof (spec))
   {
-	if (!f->sym || f->sym->attr.pointer || f->sym->attr.target
+	bool is_class = false;
+	bool is_pointer = false;
+
+	if (f->sym)
+	  {
+	symbol_attribute *attr = NULL;
+
+	is_class = f->sym->ts.type == BT_CLASS && CLASS_DATA (f->sym)
+	  && f->sym->attr.class_ok;
+	attr = is_class ? &(CLASS_DATA (f->sym)->attr) : &(f->sym->attr);
+	is_pointer = is_class ? attr->class_pointer : attr->pointer;
+	  }
+
+	if (f->sym == NULL || is_pointer || f->sym->attr.target
 	|| f->sym->attr.external || f->sym->attr.cray_pointer
 	|| (f->sym->ts.type == BT_DERIVED
 		&& (f->sym->ts.u.derived->attr.proc_pointer_comp
 		|| f->sym->ts.u.derived->attr.pointer_comp))
-	|| (f->sym->ts.type == BT_CLASS
+	|| (is_class
 		&& (CLASS_DATA (f->sym)->ts.u.derived->attr.proc_pointer_comp
 		|| CLASS_DATA (f->sym)->ts.u.derived->attr.pointer_comp))
 	|| (f->sym->ts.type == BT_INTEGER && f->sym->ts.is_c_interop))
diff --git a/gcc/testsuite/gfortran.dg/PR100132.f90 b/gcc/testsuite/gfortran.dg/PR100132.f90
new file mode 100644
index 000..aec0fef3d26
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR100132.f90
@@ -0,0 +1,81 @@
+! { dg-do run }
+!
+! Test the fix for PR100132
+!
+
+module main_m
+
+  implicit none
+
+  private
+
+  public :: &
+foo_t
+
+  public :: &
+set,&
+get
+  
+  type :: foo_t
+!private
+integer :: i
+  end type foo_t
+
+  type(foo_t), save, pointer :: data => null()
+  
+contains
+
+  subroutine set(this)
+class(foo_t), pointer, intent(in) :: this
+
+if(associated(data)) stop 1
+data => this
+return
+  end subroutine set
+
+  subroutine get(this)
+type(foo_t), pointer, intent(out) :: this
+
+if(.not.associated(data)) stop 4
+this => data
+nullify(data)
+return
+  end subroutine get
+
+end module main_m
+
+program main_p
+
+  use :: main_m, only: &
+foo_t, set, get
+
+  implicit none
+
+  integer, parameter :: n = 1000
+
+  type(foo_t), pointer :: ps
+  type(foo_t),  target :: s
+  integer  :: i, j, yay, nay
+
+  yay = 0
+  nay = 0
+  do i = 1, n
+s%i = i
+call set(s)
+call get(ps)
+if(.not.associated(ps)) stop 13
+j = ps%i
+if(i/=j) stop 14
+if(i/=s%i) stop 15
+if(ps%i/=s%i) stop 16
+if(associated(ps, s))then
+  yay = yay + 1
+else
+  nay = nay + 1
+end if
+  end do
+  if((yay/=n).or.(nay/=0)) stop 17
+  stop
+
+end program main_p
+


Re: [Patch, fortran v2] PR fortran/84006, PR fortran/100027 - ICE on storage_size with polymorphic argument

2021-04-17 Thread Paul Richard Thomas via Gcc-patches
Hi Jose,

Please take a look at my reply on the PR, which points to PR98534.

Regards

Paul


On Fri, 16 Apr 2021 at 20:47, José Rui Faustino de Sousa via Fortran <
fort...@gcc.gnu.org> wrote:

> Hi All!
>
> Proposed patch to:
> PR84006 - [8/9/10/11 Regression] ICE in storage_size() with CLASS entity
> PR100027 - ICE on storage_size with polymorphic argument
>
> Patch tested only on x86_64-pc-linux-gnu.
>
> Add branch to if clause to handle polymorphic objects, not sure if I got
> all possible variations...
>
> Now with a new and extended test.
>
> Thank you very much.
>
> Best regards,
> José Rui
>
> Fortran: Fix ICE using storage_size intrinsic [PR84006, PR100027]
>
> gcc/fortran/ChangeLog:
>
>  PR fortran/84006
>  PR fortran/100027
>  * trans-intrinsic.c (gfc_conv_intrinsic_storage_size): add if
>  clause branch to handle polymorphic objects.
>
> gcc/testsuite/ChangeLog:
>
>  PR fortran/84006
>  * gfortran.dg/PR84006.f90: New test.
>
>  PR fortran/100027
>  * gfortran.dg/PR100027.f90: New test.
>


-- 
"If you can't explain it simply, you don't understand it well enough" -
Albert Einstein


[committed] d: Add TARGET_D_TEMPLATES_ALWAYS_COMDAT

2021-04-17 Thread Iain Buclaw via Gcc-patches
Hi,

Following up on the fix for PR99914, when testing on MinGW, it was found
not to support weak in the same way as on ELF or Mach-O targets.

So the linkage has been reverted back to COMDAT for that target, however
in order to properly support overriding functions and variables, all
declarations with external linkage must be put on COMDAT.  For this a
new target hook has been added to control the behavior.

Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, as
well as on a preliminary x86_64-w64-mingw32 port, committed to mainline.

Regards,
Iain

---
gcc/ChangeLog:

PR d/99914
* config/i386/winnt-d.c (TARGET_D_TEMPLATES_ALWAYS_COMDAT): Define.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in (D language and ABI): Add @hook for
TARGET_D_TEMPLATES_ALWAYS_COMDAT.

gcc/d/ChangeLog:

PR d/99914
* d-target.def (d_templates_always_comdat): New hook.
* d-tree.h (mark_needed): Remove prototype.
* decl.cc: Include d-target.h.
(mark_needed): Rename to...
(d_mark_needed): ...this.  Make static.
(set_linkage_for_decl): Put variables in comdat if
d_templates_always_comdat.
---
 gcc/config/i386/winnt-d.c |  5 +
 gcc/d/d-target.def|  8 
 gcc/d/d-tree.h|  1 -
 gcc/d/decl.cc | 17 +++--
 gcc/doc/tm.texi   |  6 ++
 gcc/doc/tm.texi.in|  2 ++
 6 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/gcc/config/i386/winnt-d.c b/gcc/config/i386/winnt-d.c
index b9780258549..ea4cd13d0bf 100644
--- a/gcc/config/i386/winnt-d.c
+++ b/gcc/config/i386/winnt-d.c
@@ -78,4 +78,9 @@ winnt_d_register_target_info (void)
 #undef TARGET_D_MINFO_END_NAME
 #define TARGET_D_MINFO_END_NAME "__stop_minfo"
 
+/* Define TARGET_D_TEMPLATES_ALWAYS_COMDAT for Windows targets.  */
+
+#undef TARGET_D_TEMPLATES_ALWAYS_COMDAT
+#define TARGET_D_TEMPLATES_ALWAYS_COMDAT true
+
 struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;
diff --git a/gcc/d/d-target.def b/gcc/d/d-target.def
index aa6bf55e6e6..67647515cf2 100644
--- a/gcc/d/d-target.def
+++ b/gcc/d/d-target.def
@@ -104,5 +104,13 @@ and @var{link_windows} to @code{1} to apply @code{stdcall} 
to functions with\n\
  bool, (unsigned int *link_system, unsigned int *link_windows),
  hook_bool_uintp_uintp_false)
 
+/* True if instantiations are always COMDAT if they have external linkage.  */
+DEFHOOKPOD
+(d_templates_always_comdat,
+ "This flag is true if instantiated functions and variables are always 
COMDAT\n\
+if they have external linkage.  If this flag is false, then instantiated\n\
+decls will be emitted as weak symbols.  The default is @code{false}.",
+ bool, false)
+
 /* Close the 'struct gcc_targetdm' definition.  */
 HOOK_VECTOR_END (C90_EMPTY_HACK)
diff --git a/gcc/d/d-tree.h b/gcc/d/d-tree.h
index c1b6f275149..bb731a60541 100644
--- a/gcc/d/d-tree.h
+++ b/gcc/d/d-tree.h
@@ -631,7 +631,6 @@ extern void d_finish_decl (tree);
 extern tree make_thunk (FuncDeclaration *, int);
 extern tree start_function (FuncDeclaration *);
 extern void finish_function (tree);
-extern void mark_needed (tree);
 extern tree get_vtable_decl (ClassDeclaration *);
 extern tree build_new_class_expr (ClassReferenceExp *);
 extern tree aggregate_initializer_decl (AggregateDeclaration *);
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index 8948e40e902..7d1378255bd 100644
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -59,6 +59,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "symtab-thunks.h"
 
 #include "d-tree.h"
+#include "d-target.h"
 
 
 /* Return identifier for the external mangled name of DECL.  */
@@ -1960,8 +1961,8 @@ finish_function (tree old_context)
 /* Mark DECL, which is a VAR_DECL or FUNCTION_DECL as a symbol that
must be emitted in this, output module.  */
 
-void
-mark_needed (tree decl)
+static void
+d_mark_needed (tree decl)
 {
   TREE_USED (decl) = 1;
 
@@ -2380,6 +2381,18 @@ set_linkage_for_decl (tree decl)
   if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl))
 return d_comdat_linkage (decl);
 
+  /* If all instantiations must go in COMDAT, give them that linkage.
+ This also applies to other extern declarations, so that it is possible
+ for them to override template declarations.  */
+  if (targetdm.d_templates_always_comdat)
+{
+  /* Make sure that instantiations are not removed.  */
+  if (flag_weak_templates && DECL_INSTANTIATED (decl))
+   d_mark_needed (decl);
+
+  return d_comdat_linkage (decl);
+}
+
   /* Instantiated variables and functions need to be overridable by any other
  symbol with the same name, so give them weak linkage.  */
   if (DECL_INSTANTIATED (decl))
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 97c8eebcd6f..823f85ba9ab 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -10850,6 +10850,12 @@ and @var{link_windows} to @code{1} to apply 
@code{stdcall} to functions with
 @code{extern(Windows)} 

[committed] d: Implement __traits(getTargetInfo, "objectFormat")

2021-04-17 Thread Iain Buclaw via Gcc-patches
Hi,

Following on from adding TARGET_D_REGISTER_OS_TARGET_INFO, this adds the
required handlers to implement `__traits(getTargetInfo, "objectFormat")'
for all platforms that have D support files.

Some back-ends (i386, rs6000, and pa) have some awarenes of the what
object format they are compiling for, so new getTargetInfo handlers have
been have added both to those back-ends as well as platform-specific
target files to override the default in the D front-end.

Testing has been done with the following code (also validating other
changes that that been made to the front-end for MinGW support):

alias SystemFn = extern(System) void function();
alias WindowsFn = extern(Windows) void function();
pragma(msg,
" System: '", __traits(getLinkage, SystemFn),
"' Windows: '", __traits(getLinkage, WindowsFn),
"' floatAbi: '", __traits(getTargetInfo, "floatAbi"),
"' objectFormat: '", __traits(getTargetInfo, "objectFormat"),
"'");

With the results on these target configurations:

aarch64-linux-gnu:
 System: 'C' Windows: 'Windows' floatAbi: 'hard' objectFormat: 'elf'

arm-eabi:
 System: 'C' Windows: 'Windows' floatAbi: 'soft' objectFormat: 'elf'

hppa2.0-hpux11.9:
 System: 'C' Windows: 'Windows' floatAbi: 'hard' objectFormat: 'som'

hppa64-linux-gnu:
 System: 'C' Windows: 'Windows' floatAbi: 'hard' objectFormat: 'elf'

i686-pc-linux-gnu:
 System: 'C' Windows: 'Windows' floatAbi: 'hard' objectFormat: 'elf'

i686-pc-msdosdjgpp:
 System: 'C' Windows: 'Windows' floatAbi: 'hard' objectFormat: 'coff'

i686-solaris2.11:
 System: 'C' Windows: 'Windows' floatAbi: 'hard' objectFormat: 'elf'

mips-netbsd:
 System: 'C' Windows: 'Windows' floatAbi: 'hard' objectFormat: 'elf'

powerpc64-darwin:
 System: 'C' Windows: 'Windows' floatAbi: 'hard' objectFormat: 'macho'

powerpc-eabi:
 System: 'C' Windows: 'Windows' floatAbi: 'hard' objectFormat: 'elf'

riscv64-unknown-linux-gnu:
 System: 'C' Windows: 'Windows' floatAbi: 'soft' objectFormat: 'elf'

rs6000-ibm-aix7.1:
 System: 'C' Windows: 'Windows' floatAbi: 'hard' objectFormat: 'coff'

s390x-linux-gnu:
 System: 'C' Windows: 'Windows' floatAbi: 'hard' objectFormat: 'elf'

sparc64-freebsd6:
 System: 'C' Windows: 'Windows' floatAbi: 'hard' objectFormat: 'elf'

x86_64-apple-darwin:
 System: 'C' Windows: 'Windows' floatAbi: 'hard' objectFormat: 'macho'

x86_64-dragonfly:
 System: 'C' Windows: 'Windows' floatAbi: 'hard' objectFormat: 'elf'

x86_64-w64-mingw32:
 System: 'Windows' Windows: 'Windows' floatAbi: 'hard' objectFormat: 'coff'

As well as the above listed cross-compiled target configurations,
bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, and
committed to mainline.

Regards,
Iain.

---
gcc/ChangeLog:

* config/darwin-d.c (darwin_d_handle_target_object_format): New
function.
(darwin_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/dragonfly-d.c (dragonfly_d_handle_target_object_format): New
function.
(dragonfly_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/freebsd-d.c (freebsd_d_handle_target_object_format): New
function.
(freebsd_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/glibc-d.c (glibc_d_handle_target_object_format): New
function.
(glibc_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/i386/i386-d.c (ix86_d_handle_target_object_format): New
function.
(ix86_d_register_target_info): Add ix86_d_handle_target_object_format
as handler for objectFormat key.
* config/i386/winnt-d.c (winnt_d_handle_target_object_format): New
function.
(winnt_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/netbsd-d.c (netbsd_d_handle_target_object_format): New
function.
(netbsd_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/openbsd-d.c (openbsd_d_handle_target_object_format): New
function.
(openbsd_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.
* config/pa/pa-d.c (pa_d_handle_target_object_format): New function.
(pa_d_register_target_info): Add pa_d_handle_target_object_format as
handler for objectFormat key.
* config/rs6000/rs6000-d.c (rs6000_d_handle_target_object_format): New
function.
(rs6000_d_register_target_info): Add
rs6000_d_handle_target_object_format as handler for objectFormat key.
* config/sol2-d.c (solaris_d_handle_target_object_format): New
function.
(solaris_d_register_target_info): New function.
(TARGET_D_REGISTER_OS_TARGET_INFO): Define.

gcc/d/ChangeLog:

* d-target.cc 

[committed] sanitizer: Fix asan against glibc 2.34 [PR100114]

2021-04-17 Thread Jakub Jelinek via Gcc-patches
Hi!

As mentioned in the PR, SIGSTKSZ is no longer a compile time constant in
glibc 2.34 and later, so
static const uptr kAltStackSize = SIGSTKSZ * 4;
needs dynamic initialization, but is used by a function called indirectly
from .preinit_array and therefore before the variable is constructed.
This results in using 0 size instead and all asan instrumented programs
die with:
==91==ERROR: AddressSanitizer failed to allocate 0x0 (0) bytes of 
SetAlternateSignalStack (error code: 22)

Here is a cherry-pick from upstream to fix this.

Bootstrapped/regtested on {x86_64,i686,powerpc64le,s390x,aarch64,armv7hl}-linux,
both against glibc 2.33 and 2.34 snapshots and verified the testresults
are back to roughly the same in between those two, while previously
basically all asan tests failed.
Committed to trunk.

2021-04-17  Jakub Jelinek  

PR sanitizer/100114
* sanitizer_common/sanitizer_posix_libcdep.cpp: Cherry-pick
llvm-project revisions 82150606fb11d28813ae6da1101f5bda638165fe
and b93629dd335ffee2fc4b9b619bf86c3f9e6b0023.

--- libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp
+++ libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp
@@ -165,7 +165,11 @@ bool SupportsColoredOutput(fd_t fd) {
 
 #if !SANITIZER_GO
 // TODO(glider): different tools may require different altstack size.
-static const uptr kAltStackSize = SIGSTKSZ * 4;  // SIGSTKSZ is not enough.
+static uptr GetAltStackSize() {
+  // SIGSTKSZ is not enough.
+  static const uptr kAltStackSize = SIGSTKSZ * 4;
+  return kAltStackSize;
+}
 
 void SetAlternateSignalStack() {
   stack_t altstack, oldstack;
@@ -176,10 +180,9 @@ void SetAlternateSignalStack() {
   // TODO(glider): the mapped stack should have the MAP_STACK flag in the
   // future. It is not required by man 2 sigaltstack now (they're using
   // malloc()).
-  void* base = MmapOrDie(kAltStackSize, __func__);
-  altstack.ss_sp = (char*) base;
+  altstack.ss_size = GetAltStackSize();
+  altstack.ss_sp = (char *)MmapOrDie(altstack.ss_size, __func__);
   altstack.ss_flags = 0;
-  altstack.ss_size = kAltStackSize;
   CHECK_EQ(0, sigaltstack(, nullptr));
 }
 
@@ -187,7 +190,7 @@ void UnsetAlternateSignalStack() {
   stack_t altstack, oldstack;
   altstack.ss_sp = nullptr;
   altstack.ss_flags = SS_DISABLE;
-  altstack.ss_size = kAltStackSize;  // Some sane value required on Darwin.
+  altstack.ss_size = GetAltStackSize();  // Some sane value required on Darwin.
   CHECK_EQ(0, sigaltstack(, ));
   UnmapOrDie(oldstack.ss_sp, oldstack.ss_size);
 }


Jakub



Re: enable __ieee128 for p9vector tests

2021-04-17 Thread Alexandre Oliva
On Apr 12, 2021, Segher Boessenkool  wrote:

> Hi!
> Sorry for the late answer.

> On Fri, Apr 02, 2021 at 01:52:59PM -0300, Alexandre Oliva wrote:
>> Several compile tests that use the __ieee128 type do not ensure it is
>> defined.  This patch adds -mfloat128 to their command lines, and
>> disregards the warning that may be issued by it.

> But they do make sure it is defined, they use -mcpu=power9 (etc.).  What
> is different in your setup that that does not work?

I suppose it's either -mno-altivec -mno-vsx in our self-specs, or the
very old default CPU.  I imagine it's also possible that the issue,
initially observed with GCC 10, is different or absent with the trunk.

I started trying to figure out what led __ieee128 to not be enabled
there, back then, but decided it was not so important, given that other
tests used this flag explicitly, and that it wouldn't hurt to have it
even if it wasn't always necessary.

Now, if you tell me that, even with our implicit flags and old CPU
selection, -mfloat128 should not be necessary to enable the __ieee128
type, I would be glad to dig further to try and fix the underlying bug.

Thanks,

-- 
Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
   Free Software Activist GNU Toolchain Engineer
Vim, Vi, Voltei pro Emacs -- GNUlius Caesar