Bug 35896 - [4.4 Regression] gfortran TLS symbols broken with debug info
Summary: [4.4 Regression] gfortran TLS symbols broken with debug info
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.4.0
: P1 normal
Target Milestone: 4.4.0
Assignee: Jakub Jelinek
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: openmp, wrong-code
Depends on:
Blocks:
 
Reported: 2008-04-09 22:44 UTC by Janis Johnson
Modified: 2008-05-25 20:24 UTC (History)
3 users (show)

See Also:
Host:
Target: powerpc64-unknown-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-04-29 16:07:37


Attachments
generated code before patch (1.13 KB, text/plain)
2008-04-09 22:46 UTC, Janis Johnson
Details
generated code after patch (1.08 KB, text/plain)
2008-04-09 22:47 UTC, Janis Johnson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Janis Johnson 2008-04-09 22:44:30 UTC
Four tests in libgomp.fortran (omp_parse3.f90, pr25162.f, and threadprivate[23].f90 started failing with this patch:

  http://gcc.gnu.org/viewcvs?view=rev&rev=133801
  r133801 | george | 2008-04-01 17:23:36 -0400 (Tue, 01 Apr 2008)

This small testcase fails in the same way when compiled with "-m64 -g -fopenmp":

      program test
      call foo
      end
      subroutine foo
      real testvar
      common /testcom/ testvar
c$omp threadprivate(/testcom/)
      testvar = 1.0
      return
      end

Output:

elm3b145% /opt/gcc-nightly/trunk-20080406/bin/gfortran -g -m64 -fopenmp tls1.f -lgomp
/opt/gcc-nightly/binutils-2.18/bin/ld: /tmp/cc0dFrjq.o(.debug_info+0x74): R_PPC64_ADDR64 used with TLS symbol testcom_

I'll attach the .s files for revisions 133800 and 133801 for the same source but without the first three lines.
Comment 1 Janis Johnson 2008-04-09 22:46:45 UTC
Created attachment 15462 [details]
generated code before patch
Comment 2 Janis Johnson 2008-04-09 22:47:20 UTC
Created attachment 15463 [details]
generated code after patch
Comment 3 Andrew Pinski 2008-04-09 22:50:28 UTC
I think we are emitting the debug info too early for _testcom before we marked it as a TLS.
Comment 4 Andrew Pinski 2008-04-09 22:51:54 UTC
Before:
	.quad	testcom_@dtprel+0x8000

After:
	.8byte	testcom_

Comment 5 Andrew Pinski 2008-04-09 22:54:04 UTC
Actually we just don't take into account  TLSness of the decl/RTL.
Comment 6 Jakub Jelinek 2008-05-07 23:16:36 UTC
Subject: Bug 35896

Author: jakub
Date: Wed May  7 23:15:50 2008
New Revision: 135060

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=135060
Log:
	PR debug/35896
	* dwarf2out.c (dw_expand_expr, common_check): Removed.
	(fortran_common): New function.
	(gen_variable_die): Call fortran_common instead of common_check,
	adjust for it returning tree instead of rtx.    Formatting.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c

Comment 7 Jakub Jelinek 2008-05-25 20:24:46 UTC
Fixed.