This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[SPARC] Fix PR target/54121


This is a regression present on mainline and 4.7 branch for the SPARC.  Reload 
is trying to change the value of a symbol(!) because it is mightily confused 
by an output constraint on a source operand (old pasto in some TLS patterns).

Fixed thusly, tested on SPARC64/Linux, applied on all branches.


2012-12-11  Eric Botcazou  <ebotcazou@adacore.com>

	PR target/54121
	* config/sparc/sparc.md (tldo_stb_sp32): Fix pasto.
	(tldo_stb_sp64): Likewise.
	(tldo_sth_sp32): Likewise.
	(tldo_sth_sp64): Likewise.
	(tldo_stw_sp32): Likewise.
	(tldo_stw_sp64): Likewise.
	(tldo_stx_sp64): Likewise.


2012-12-11  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc.dg/pr54121.c: New test.


-- 
Eric Botcazou
Index: config/sparc/sparc.md
===================================================================
--- config/sparc/sparc.md	(revision 194382)
+++ config/sparc/sparc.md	(working copy)
@@ -7757,7 +7757,7 @@ (define_insn "*tldo_stb_sp32"
 				     (match_operand 3 "tld_symbolic_operand" "")]
 				    UNSPEC_TLSLDO)
 			 (match_operand:SI 1 "register_operand" "r")))
-	(match_operand:QI 0 "register_operand" "=r"))]
+	(match_operand:QI 0 "register_operand" "r"))]
   "TARGET_TLS && TARGET_ARCH32"
   "stb\t%0, [%1 + %2], %%tldo_add(%3)"
   [(set_attr "type" "store")])
@@ -7767,7 +7767,7 @@ (define_insn "*tldo_stb_sp64"
 				     (match_operand 3 "tld_symbolic_operand" "")]
 				    UNSPEC_TLSLDO)
 			 (match_operand:DI 1 "register_operand" "r")))
-	(match_operand:QI 0 "register_operand" "=r"))]
+	(match_operand:QI 0 "register_operand" "r"))]
   "TARGET_TLS && TARGET_ARCH64"
   "stb\t%0, [%1 + %2], %%tldo_add(%3)"
   [(set_attr "type" "store")])
@@ -7777,7 +7777,7 @@ (define_insn "*tldo_sth_sp32"
 				     (match_operand 3 "tld_symbolic_operand" "")]
 				    UNSPEC_TLSLDO)
 			 (match_operand:SI 1 "register_operand" "r")))
-	(match_operand:HI 0 "register_operand" "=r"))]
+	(match_operand:HI 0 "register_operand" "r"))]
   "TARGET_TLS && TARGET_ARCH32"
   "sth\t%0, [%1 + %2], %%tldo_add(%3)"
   [(set_attr "type" "store")])
@@ -7787,7 +7787,7 @@ (define_insn "*tldo_sth_sp64"
 				     (match_operand 3 "tld_symbolic_operand" "")]
 				    UNSPEC_TLSLDO)
 			 (match_operand:DI 1 "register_operand" "r")))
-	(match_operand:HI 0 "register_operand" "=r"))]
+	(match_operand:HI 0 "register_operand" "r"))]
   "TARGET_TLS && TARGET_ARCH64"
   "sth\t%0, [%1 + %2], %%tldo_add(%3)"
   [(set_attr "type" "store")])
@@ -7797,7 +7797,7 @@ (define_insn "*tldo_stw_sp32"
 				     (match_operand 3 "tld_symbolic_operand" "")]
 				    UNSPEC_TLSLDO)
 			 (match_operand:SI 1 "register_operand" "r")))
-	(match_operand:SI 0 "register_operand" "=r"))]
+	(match_operand:SI 0 "register_operand" "r"))]
   "TARGET_TLS && TARGET_ARCH32"
   "st\t%0, [%1 + %2], %%tldo_add(%3)"
   [(set_attr "type" "store")])
@@ -7807,7 +7807,7 @@ (define_insn "*tldo_stw_sp64"
 				     (match_operand 3 "tld_symbolic_operand" "")]
 				    UNSPEC_TLSLDO)
 			 (match_operand:DI 1 "register_operand" "r")))
-	(match_operand:SI 0 "register_operand" "=r"))]
+	(match_operand:SI 0 "register_operand" "r"))]
   "TARGET_TLS && TARGET_ARCH64"
   "stw\t%0, [%1 + %2], %%tldo_add(%3)"
   [(set_attr "type" "store")])
@@ -7817,7 +7817,7 @@ (define_insn "*tldo_stx_sp64"
 				     (match_operand 3 "tld_symbolic_operand" "")]
 				    UNSPEC_TLSLDO)
 			 (match_operand:DI 1 "register_operand" "r")))
-	(match_operand:DI 0 "register_operand" "=r"))]
+	(match_operand:DI 0 "register_operand" "r"))]
   "TARGET_TLS && TARGET_ARCH64"
   "stx\t%0, [%1 + %2], %%tldo_add(%3)"
   [(set_attr "type" "store")])
/* PR target/54121 */
/* Reported by Jan Engelhardt <jengelh@inai.de> */

/* { dg-do compile { target fpic } } */
/* { dg-options "-std=gnu99 -O -fPIC -fprofile-generate" } */

typedef __SIZE_TYPE__ size_t;
typedef unsigned char uint8_t;

extern void *memcpy (void *__restrict __dest,
       __const void *__restrict __src, size_t __n)
     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));

typedef enum {
 LZMA_OK = 0,
 LZMA_STREAM_END = 1,
 LZMA_NO_CHECK = 2,
 LZMA_UNSUPPORTED_CHECK = 3,
 LZMA_GET_CHECK = 4,
 LZMA_MEM_ERROR = 5,
 LZMA_MEMLIMIT_ERROR = 6,
 LZMA_FORMAT_ERROR = 7,
 LZMA_OPTIONS_ERROR = 8,
 LZMA_DATA_ERROR = 9,
 LZMA_BUF_ERROR = 10,
 LZMA_PROG_ERROR = 11,
} lzma_ret;

typedef enum {
 LZMA_RUN = 0,
 LZMA_SYNC_FLUSH = 1,
 LZMA_FULL_FLUSH = 2,
 LZMA_FINISH = 3
} lzma_action;

typedef struct {
 void *( *alloc)(void *opaque, size_t nmemb, size_t size);
 void ( *free)(void *opaque, void *ptr);
 void *opaque;
} lzma_allocator;

typedef struct lzma_coder_s lzma_coder;

typedef struct lzma_next_coder_s lzma_next_coder;

typedef struct lzma_filter_info_s lzma_filter_info;

typedef lzma_ret (*lzma_init_function)(
  lzma_next_coder *next, lzma_allocator *allocator,
  const lzma_filter_info *filters);

typedef lzma_ret (*lzma_code_function)(
  lzma_coder *coder, lzma_allocator *allocator,
  const uint8_t *restrict in, size_t *restrict in_pos,
  size_t in_size, uint8_t *restrict out,
  size_t *restrict out_pos, size_t out_size,
  lzma_action action);

typedef void (*lzma_end_function)(
  lzma_coder *coder, lzma_allocator *allocator);

typedef struct {
 uint8_t *buf;
 size_t pos;
 size_t size;
} lzma_dict;

typedef struct {
 lzma_coder *coder;
 lzma_ret (*code)(lzma_coder *restrict coder,
   lzma_dict *restrict dict, const uint8_t *restrict in,
   size_t *restrict in_pos, size_t in_size);
} lzma_lz_decoder;

struct lzma_coder_s {
 lzma_dict dict;
 lzma_lz_decoder lz;
};

lzma_ret
decode_buffer(lzma_coder *coder,
  const uint8_t *restrict in, size_t *restrict in_pos,
  size_t in_size, uint8_t *restrict out, size_t *restrict out_pos)
{
 while (1) {
  const size_t dict_start = coder->dict.pos;
  const lzma_ret ret
    = coder->lz.code( coder->lz.coder, &coder->dict, in, in_pos, in_size);
  const size_t copy_size = coder->dict.pos - dict_start;
  memcpy(out + *out_pos, coder->dict.buf + dict_start, copy_size);
  if (ret != LZMA_OK || coder->dict.pos < coder->dict.size)
   return ret;
 }
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]