[PATCH] fortran: Drop -static-lib{gfortran,quadmath} from f951 [PR46539]

2022-08-20 Thread Jakub Jelinek via Fortran
Hi!

As discussed earlier, all other -static-lib* options are Driver only,
these 2 are Driver in common.opt and Fortran in lang.opt.

The spec files never pass the -static-lib* options down to any compiler
(f951 etc.), so the 2 errors below are reported only when one
runs ./f951 -static-libgfortran by hand.

The following patch just removes f951 support of these options, the
gfortran driver behavior remains as before.  For other -static-lib*
option (and even these because it is never passed to f951) we never
error if we can't support those options, and e.g. Darwin is actually
able to handle those options through other means.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2022-08-20  Jakub Jelinek  

PR fortran/46539
* lang.opt (static-libgfortran, static-libquadmath): Change Fortran
to Driver.
* options.cc (gfc_handle_option): Don't handle OPT_static_libgfortran
nor OPT_static_libquadmath here.

--- gcc/fortran/lang.opt.jj 2022-08-17 17:00:28.558530108 +0200
+++ gcc/fortran/lang.opt2022-08-19 18:09:23.505859992 +0200
@@ -860,11 +860,11 @@ Fortran Joined Separate
 ; Documented in common.opt
 
 static-libgfortran
-Fortran
+Driver
 Statically link the GNU Fortran helper library (libgfortran).
 
 static-libquadmath
-Fortran
+Driver
 Statically link the GCC Quad-Precision Math Library (libquadmath).
 
 std=f2003
--- gcc/fortran/options.cc.jj   2022-08-17 17:00:28.559530096 +0200
+++ gcc/fortran/options.cc  2022-08-19 18:05:32.153797148 +0200
@@ -685,20 +685,6 @@ gfc_handle_option (size_t scode, const c
   gfc_option.source_form = FORM_FREE;
   break;
 
-case OPT_static_libgfortran:
-#ifndef HAVE_LD_STATIC_DYNAMIC
-  gfc_fatal_error ("%<-static-libgfortran%> is not supported in this "
-  "configuration");
-#endif
-  break;
-
-case OPT_static_libquadmath:
-#ifndef HAVE_LD_STATIC_DYNAMIC
-  gfc_fatal_error ("%<-static-libquadmath%> is not supported in this "
-  "configuration");
-#endif
-  break;
-
 case OPT_fintrinsic_modules_path:
 case OPT_fintrinsic_modules_path_:
 

Jakub



Re: [PATCH] fortran: Drop -static-lib{gfortran,quadmath} from f951 [PR46539]

2022-08-20 Thread Mikael Morin

Le 20/08/2022 à 10:41, Jakub Jelinek via Fortran a écrit :

Hi!

As discussed earlier, all other -static-lib* options are Driver only,
these 2 are Driver in common.opt and Fortran in lang.opt.

The spec files never pass the -static-lib* options down to any compiler
(f951 etc.), so the 2 errors below are reported only when one
runs ./f951 -static-libgfortran by hand.

The following patch just removes f951 support of these options, the
gfortran driver behavior remains as before.  For other -static-lib*
option (and even these because it is never passed to f951) we never
error if we can't support those options, and e.g. Darwin is actually
able to handle those options through other means.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?



OK, thanks.



[PATCH] Fortran: fix simplification of intrinsics IBCLR and IBSET [PR106557]

2022-08-20 Thread Harald Anlauf via Fortran
Dear all,

the simplification of the TRANSFER intrinsic produces a
redundant representation of the result, one in expr->value
and another in expr->representation.string.  This is done
to ensure a safe "round-trip" for nested TRANSFER.

In a subsequent use of this result we either need to make
sure that both parts stay consistent, or drop the latter
part.

The simplifications of IBCLR and IBSET do a gfc_copy_expr
of their argument x and modify only the former part.
Depending on context, either value.integer or
representation.string (if non-NULL) are used later,
leading to surprising results.

A conservative approach to fix this PR is to simply
drop the unneeded representation.string in the
simplification of the intrinsics IBCLR and IBSET,
see attached patch.  (A quick glance did not turn up
other intrinsics affected the same way.)

Regtested on x86_64-pc-linux-gnu.  OK for mainline?

Thanks,
Harald

From a540a806cf02d739a408f129738252e73f03e60c Mon Sep 17 00:00:00 2001
From: Harald Anlauf 
Date: Sat, 20 Aug 2022 20:36:28 +0200
Subject: [PATCH] Fortran: fix simplification of intrinsics IBCLR and IBSET
 [PR106557]

gcc/fortran/ChangeLog:

	PR fortran/106557
	* simplify.cc (gfc_simplify_ibclr): Ensure consistent results of
	the simplification by dropping a redundant memory representation
	of argument x.
	(gfc_simplify_ibset): Likewise.

gcc/testsuite/ChangeLog:

	PR fortran/106557
	* gfortran.dg/pr106557.f90: New test.
---
 gcc/fortran/simplify.cc| 14 ++
 gcc/testsuite/gfortran.dg/pr106557.f90 | 19 +++
 2 files changed, 33 insertions(+)
 create mode 100644 gcc/testsuite/gfortran.dg/pr106557.f90

diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc
index fb725994653..f992c31e5d7 100644
--- a/gcc/fortran/simplify.cc
+++ b/gcc/fortran/simplify.cc
@@ -3380,6 +3380,13 @@ gfc_simplify_ibclr (gfc_expr *x, gfc_expr *y)
   k = gfc_validate_kind (x->ts.type, x->ts.kind, false);

   result = gfc_copy_expr (x);
+  /* Drop any separate memory representation of x to avoid potential
+ inconsistencies in result.  */
+  if (result->representation.string)
+{
+  free (result->representation.string);
+  result->representation.string = NULL;
+}

   convert_mpz_to_unsigned (result->value.integer,
 			   gfc_integer_kinds[k].bit_size);
@@ -3471,6 +3478,13 @@ gfc_simplify_ibset (gfc_expr *x, gfc_expr *y)
   k = gfc_validate_kind (x->ts.type, x->ts.kind, false);

   result = gfc_copy_expr (x);
+  /* Drop any separate memory representation of x to avoid potential
+ inconsistencies in result.  */
+  if (result->representation.string)
+{
+  free (result->representation.string);
+  result->representation.string = NULL;
+}

   convert_mpz_to_unsigned (result->value.integer,
 			   gfc_integer_kinds[k].bit_size);
diff --git a/gcc/testsuite/gfortran.dg/pr106557.f90 b/gcc/testsuite/gfortran.dg/pr106557.f90
new file mode 100644
index 000..d073f3e7186
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr106557.f90
@@ -0,0 +1,19 @@
+! { dg-do run }
+! { dg-additional-options "-fdump-tree-original" }
+! PR fortran/106557 - nesting intrinsics ibset and transfer gives wrong result
+
+program p
+  implicit none
+  character(1) :: s
+
+  write(s,'(i1)') ibset (transfer (0, 0), 0)
+  if (s /= '1') stop 1
+  write(s,'(i1)') ibclr (transfer (1, 0), 0)
+  if (s /= '0') stop 2
+
+  ! These shall be fully resolved at compile time:
+  if (transfer   (ibset (transfer (0, 0), 0), 0) /= 1) stop 3
+  if (transfer   (ibclr (transfer (1, 0), 0), 0) /= 0) stop 4
+end
+
+! { dg-final { scan-tree-dump-times "_gfortran_stop_numeric" 2 "original" } }
--
2.35.3



VISAカード お支払い金額確定のご案内

2022-08-20 Thread VISA認証 via Fortran
【VISAカード】利用いただき、ありがとうございます。
このたび、ご本人様のご利用かどうかを確認させていただきたいお取引がありましたので、誠に勝手ながら、カードのご利用を一部制限させていただき、ご連絡させていただきました。
つきましては、以下へアクセスの上、カードのご利用確認にご協力をお願い致します。
 お客様にはご迷惑、ご心配をお掛けし、誠に申し訳ございません。
何卒ご理解いただきたくお願い申しあげます。
ご回答をいただけない場合、カードのご利用制限が継続されることもございますので、予めご了承下さい。

■ご利用確認はこちら

ご不便とご心配をおかけしまして誠に申し訳ございませんが、
何とぞご理解賜りたくお願い申しあげます。
──
■発行者■
VISAカード
東京都中野区中野4-3-2
──
©Copyright 1996-2022. All Rights Reserved.
無断転載および再配布を禁じます。