public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/59777] New: Incorrect expansion of TLS arguments in a call
@ 2014-01-12 18:10 danglin at gcc dot gnu.org
  2014-01-12 18:13 ` [Bug middle-end/59777] " danglin at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: danglin at gcc dot gnu.org @ 2014-01-12 18:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59777

            Bug ID: 59777
           Summary: Incorrect expansion of TLS arguments in a call
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: danglin at gcc dot gnu.org
              Host: hppa-unknown-linux-gnu
            Target: hppa-unknown-linux-gnu
             Build: hppa-unknown-linux-gnu

Created attachment 31813
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31813&action=edit
Testcase.

The attached testcase shows the problem.  Argument expressions containing
a TLS symbol reference need to be precomputed as a call may be needed to
legitimize the address and this may clobber the setup for earlier arguments
causing wrong code.

For example, compilation of the testcase with:
gcc-4.8 -fPIC -DPIC -W -Wall -Wextra -Wshadow -Wformat -Wundef -D_GNU_SOURCE
-O0 cap-ng.c -fPIC -DPIC -o cap-ng
results in the following output:
$ ./cap-ng
cc
m.hdr1 = 0x400015c8
pidaaaa = 0

There seems to be some attempt to handle this in
precompute_register_parameters().


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

* [Bug middle-end/59777] Incorrect expansion of TLS arguments in a call
  2014-01-12 18:10 [Bug middle-end/59777] New: Incorrect expansion of TLS arguments in a call danglin at gcc dot gnu.org
@ 2014-01-12 18:13 ` danglin at gcc dot gnu.org
  2014-02-05  0:47 ` [Bug target/59777] " danglin at gcc dot gnu.org
  2014-02-05  1:02 ` danglin at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: danglin at gcc dot gnu.org @ 2014-01-12 18:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59777

--- Comment #1 from John David Anglin <danglin at gcc dot gnu.org> ---
Created attachment 31814
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31814&action=edit
Output from expand.

One can see in .expand that TLS arguments to printf are not being
precomputed causing wrong code.


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

* [Bug target/59777] Incorrect expansion of TLS arguments in a call
  2014-01-12 18:10 [Bug middle-end/59777] New: Incorrect expansion of TLS arguments in a call danglin at gcc dot gnu.org
  2014-01-12 18:13 ` [Bug middle-end/59777] " danglin at gcc dot gnu.org
@ 2014-02-05  0:47 ` danglin at gcc dot gnu.org
  2014-02-05  1:02 ` danglin at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: danglin at gcc dot gnu.org @ 2014-02-05  0:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59777

--- Comment #3 from John David Anglin <danglin at gcc dot gnu.org> ---
Author: danglin
Date: Wed Feb  5 00:47:25 2014
New Revision: 207494

URL: http://gcc.gnu.org/viewcvs?rev=207494&root=gcc&view=rev
Log:
    PR target/59777
    * config/pa/pa.c (legitimize_tls_address): Return original address
    if not passed a SYMBOL_REF rtx.
    (hppa_legitimize_address): Call legitimize_tls_address for all TLS
    addresses.
    (pa_emit_move_sequence): Simplify TLS source operands.
    (pa_legitimate_constant_p): Reject all TLS constants.
    * config/pa/pa.h (PA_SYMBOL_REF_TLS_P): Correct comment.
    (CONSTANT_ADDRESS_P): Reject TLS CONST addresses.


Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/config/pa/pa.c
    branches/gcc-4_8-branch/gcc/config/pa/pa.h


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

* [Bug target/59777] Incorrect expansion of TLS arguments in a call
  2014-01-12 18:10 [Bug middle-end/59777] New: Incorrect expansion of TLS arguments in a call danglin at gcc dot gnu.org
  2014-01-12 18:13 ` [Bug middle-end/59777] " danglin at gcc dot gnu.org
  2014-02-05  0:47 ` [Bug target/59777] " danglin at gcc dot gnu.org
@ 2014-02-05  1:02 ` danglin at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: danglin at gcc dot gnu.org @ 2014-02-05  1:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59777

John David Anglin <danglin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from John David Anglin <danglin at gcc dot gnu.org> ---
Fixed on trunk and 4.8 branch.


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

end of thread, other threads:[~2014-02-05  1:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-12 18:10 [Bug middle-end/59777] New: Incorrect expansion of TLS arguments in a call danglin at gcc dot gnu.org
2014-01-12 18:13 ` [Bug middle-end/59777] " danglin at gcc dot gnu.org
2014-02-05  0:47 ` [Bug target/59777] " danglin at gcc dot gnu.org
2014-02-05  1:02 ` danglin at gcc dot gnu.org

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