re PR other/56245 (-fsanitize=address miscompiles GCC)

PR other/56245
	* regex.c (PTR_INT_TYPE): Define.
	(EXTEND_BUFFER): Change incr type from int to PTR_INT_TYPE.

From-SVN: r195918
This commit is contained in:
Jakub Jelinek 2013-02-09 19:41:00 +01:00 committed by Jakub Jelinek
parent 0c88522946
commit 4ab7747c26
2 changed files with 12 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2013-02-09 Jakub Jelinek <jakub@redhat.com>
PR other/56245
* regex.c (PTR_INT_TYPE): Define.
(EXTEND_BUFFER): Change incr type from int to PTR_INT_TYPE.
2013-01-31 Kai Tietz <ktietz@redhat.com> 2013-01-31 Kai Tietz <ktietz@redhat.com>
PR other/54620 PR other/54620

View File

@ -4,7 +4,7 @@
internationalization features.) internationalization features.)
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2005, 2010 Free Software Foundation, Inc. 2002, 2005, 2010, 2013 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -46,9 +46,11 @@
# if defined STDC_HEADERS && !defined emacs # if defined STDC_HEADERS && !defined emacs
# include <stddef.h> # include <stddef.h>
# define PTR_INT_TYPE ptrdiff_t
# else # else
/* We need this for `regex.h', and perhaps for the Emacs include files. */ /* We need this for `regex.h', and perhaps for the Emacs include files. */
# include <sys/types.h> # include <sys/types.h>
# define PTR_INT_TYPE long
# endif # endif
# define WIDE_CHAR_SUPPORT (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC) # define WIDE_CHAR_SUPPORT (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
@ -2045,7 +2047,7 @@ static reg_errcode_t byte_compile_range (unsigned int range_start,
/* How many characters the new buffer can have? */ \ /* How many characters the new buffer can have? */ \
wchar_count = bufp->allocated / sizeof(UCHAR_T); \ wchar_count = bufp->allocated / sizeof(UCHAR_T); \
if (wchar_count == 0) wchar_count = 1; \ if (wchar_count == 0) wchar_count = 1; \
/* Truncate the buffer to CHAR_T align. */ \ /* Truncate the buffer to CHAR_T align. */ \
bufp->allocated = wchar_count * sizeof(UCHAR_T); \ bufp->allocated = wchar_count * sizeof(UCHAR_T); \
RETALLOC (COMPILED_BUFFER_VAR, wchar_count, UCHAR_T); \ RETALLOC (COMPILED_BUFFER_VAR, wchar_count, UCHAR_T); \
bufp->buffer = (char*)COMPILED_BUFFER_VAR; \ bufp->buffer = (char*)COMPILED_BUFFER_VAR; \
@ -2054,7 +2056,7 @@ static reg_errcode_t byte_compile_range (unsigned int range_start,
/* If the buffer moved, move all the pointers into it. */ \ /* If the buffer moved, move all the pointers into it. */ \
if (old_buffer != COMPILED_BUFFER_VAR) \ if (old_buffer != COMPILED_BUFFER_VAR) \
{ \ { \
int incr = COMPILED_BUFFER_VAR - old_buffer; \ PTR_INT_TYPE incr = COMPILED_BUFFER_VAR - old_buffer; \
MOVE_BUFFER_POINTER (b); \ MOVE_BUFFER_POINTER (b); \
MOVE_BUFFER_POINTER (begalt); \ MOVE_BUFFER_POINTER (begalt); \
if (fixup_alt_jump) \ if (fixup_alt_jump) \
@ -2082,7 +2084,7 @@ static reg_errcode_t byte_compile_range (unsigned int range_start,
/* If the buffer moved, move all the pointers into it. */ \ /* If the buffer moved, move all the pointers into it. */ \
if (old_buffer != COMPILED_BUFFER_VAR) \ if (old_buffer != COMPILED_BUFFER_VAR) \
{ \ { \
int incr = COMPILED_BUFFER_VAR - old_buffer; \ PTR_INT_TYPE incr = COMPILED_BUFFER_VAR - old_buffer; \
MOVE_BUFFER_POINTER (b); \ MOVE_BUFFER_POINTER (b); \
MOVE_BUFFER_POINTER (begalt); \ MOVE_BUFFER_POINTER (begalt); \
if (fixup_alt_jump) \ if (fixup_alt_jump) \