public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, Fortran] PR55343 - Fix ICE with renaming of symbols of intrinsic modules
@ 2012-12-04 11:22 Tobias Burnus
  2012-12-08 17:14 ` Janus Weil
  0 siblings, 1 reply; 3+ messages in thread
From: Tobias Burnus @ 2012-12-04 11:22 UTC (permalink / raw)
  To: gcc patches, gfortran

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

We freed the renamed symbol for intrinsic modules too early, if they 
actually exist on the disk as the name is used in trans*.c. (For "file" 
modules, the data is later freed with the namespace by calling 
gfc_free_use_stmts.)

Build and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias

[-- Attachment #2: module-free.diff --]
[-- Type: text/x-patch, Size: 1756 bytes --]

2012-12-04  Tobias Burnus  <burnus@net-b.de>

	PR fortran/55343
	* module.c (gfc_use_module): Free rename list only for
	internally generated intrinsic modules.

2012-12-04  Tobias Burnus  <burnus@net-b.de>

	PR fortran/55343
	* gfortran.dg/gomp/use_intrinsic_1.f90: New.

diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 16ea97b..cde5739 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -6157,6 +6157,8 @@ gfc_use_module (gfc_use_list *module)
 			     "intrinsic module at %C") != FAILURE)
        {
 	 use_iso_fortran_env_module ();
+	 free_rename (module->rename);
+	 module->rename = NULL;
 	 gfc_current_locus = old_locus;
 	 module->intrinsic = true;
 	 return;
@@ -6167,6 +6169,8 @@ gfc_use_module (gfc_use_list *module)
 			     "ISO_C_BINDING module at %C") != FAILURE)
 	{
 	  import_iso_c_binding_module();
+	  free_rename (module->rename);
+	  module->rename = NULL;
 	  gfc_current_locus = old_locus;
 	  module->intrinsic = true;
 	  return;
@@ -6359,8 +6363,6 @@ gfc_use_modules (void)
       next = module_list->next;
       rename_list_remove_duplicate (module_list->rename);
       gfc_use_module (module_list);
-      if (module_list->intrinsic)
-	free_rename (module_list->rename);
       free (module_list);
     }
   gfc_rename_list = NULL;
diff --git a/gcc/testsuite/gfortran.dg/gomp/use_intrinsic_1.f90 b/gcc/testsuite/gfortran.dg/gomp/use_intrinsic_1.f90
new file mode 100644
index 0000000..cab3526
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/use_intrinsic_1.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+!
+! PR fortran/55343
+!
+! Contributed by Erik Toussaint
+!
+
+use, intrinsic :: omp_lib, only: omp_get_num_threads
+use, intrinsic :: omp_lib_kinds , foo => omp_lock_kind
+print *, foo
+end

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

* Re: [Patch, Fortran] PR55343 - Fix ICE with renaming of symbols of intrinsic modules
  2012-12-04 11:22 [Patch, Fortran] PR55343 - Fix ICE with renaming of symbols of intrinsic modules Tobias Burnus
@ 2012-12-08 17:14 ` Janus Weil
  2012-12-09 15:38   ` Tobias Burnus
  0 siblings, 1 reply; 3+ messages in thread
From: Janus Weil @ 2012-12-08 17:14 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: gcc patches, gfortran

2012/12/4 Tobias Burnus <burnus@net-b.de>:
> We freed the renamed symbol for intrinsic modules too early, if they
> actually exist on the disk as the name is used in trans*.c. (For "file"
> modules, the data is later freed with the namespace by calling
> gfc_free_use_stmts.)
>
> Build and regtested on x86-64-gnu-linux.
> OK for the trunk?

Sorry, I don't get it. Wrong PR number? It sounds related, but the
test case is very different from the one in the PR ...?!?

Cheers,
Janus

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

* Re: [Patch, Fortran] PR55343 - Fix ICE with renaming of symbols of intrinsic modules
  2012-12-08 17:14 ` Janus Weil
@ 2012-12-09 15:38   ` Tobias Burnus
  0 siblings, 0 replies; 3+ messages in thread
From: Tobias Burnus @ 2012-12-09 15:38 UTC (permalink / raw)
  To: Janus Weil; +Cc: gcc patches, gfortran

Janus Weil wrote:
> Sorry, I don't get it. Wrong PR number? It sounds related, but the 
> test case is very different from the one in the PR ...?!?

Sorry, I copied the PR number from the wrong PR. (I had opened the other 
PR because they are similar.)

The patch is for PR 55197, only.

Tobias

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

end of thread, other threads:[~2012-12-09 15:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-04 11:22 [Patch, Fortran] PR55343 - Fix ICE with renaming of symbols of intrinsic modules Tobias Burnus
2012-12-08 17:14 ` Janus Weil
2012-12-09 15:38   ` Tobias Burnus

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