tcsh-6.19.00-003-avoid-gcc5-calloc-optimization.patch added
> avoid gcc-5 optimization malloc + memset = calloc (Fridolin Pokorny)
This commit is contained in:
		
							parent
							
								
									5ea5c31aec
								
							
						
					
					
						commit
						3b4edba158
					
				
							
								
								
									
										59
									
								
								tcsh-6.19.00-003-avoid-gcc5-calloc-optimization.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								tcsh-6.19.00-003-avoid-gcc5-calloc-optimization.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,59 @@ | |||||||
|  | From 624d3aebb6e6afadb4f35e894d11b5ebe290cd87 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: christos <christos> | ||||||
|  | Date: Thu, 28 May 2015 11:47:03 +0000 | ||||||
|  | Subject: [PATCH 1/2] avoid gcc-5 optimization malloc + memset = calloc | ||||||
|  |  (Fridolin Pokorny) | ||||||
|  | 
 | ||||||
|  | ---
 | ||||||
|  |  tc.alloc.c | 5 ++++- | ||||||
|  |  1 file changed, 4 insertions(+), 1 deletion(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/tc.alloc.c b/tc.alloc.c
 | ||||||
|  | index b9aec63..c1cb330 100644
 | ||||||
|  | --- a/tc.alloc.c
 | ||||||
|  | +++ b/tc.alloc.c
 | ||||||
|  | @@ -348,10 +348,13 @@ calloc(size_t i, size_t j)
 | ||||||
|  |  { | ||||||
|  |  #ifndef lint | ||||||
|  |      char *cp; | ||||||
|  | +    size_t k;
 | ||||||
|  |   | ||||||
|  |      i *= j; | ||||||
|  |      cp = xmalloc(i); | ||||||
|  | -    memset(cp, 0, i);
 | ||||||
|  | +    /* Stop gcc 5.x from optimizing malloc+memset = calloc */
 | ||||||
|  | +    k = i;
 | ||||||
|  | +    memset(cp, 0, k);
 | ||||||
|  |   | ||||||
|  |      return ((memalign_t) cp); | ||||||
|  |  #else | ||||||
|  | -- 
 | ||||||
|  | 2.5.5 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | From 05e7406049bd2686dee0ee8d819dcd38eb131f6f Mon Sep 17 00:00:00 2001 | ||||||
|  | From: christos <christos> | ||||||
|  | Date: Tue, 7 Jul 2015 12:24:54 +0000 | ||||||
|  | Subject: [PATCH 2/2] make k volatile to prevent gcc-5 memset() optimization | ||||||
|  |  (Fridolin Pokorny) | ||||||
|  | 
 | ||||||
|  | ---
 | ||||||
|  |  tc.alloc.c | 2 +- | ||||||
|  |  1 file changed, 1 insertion(+), 1 deletion(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/tc.alloc.c b/tc.alloc.c
 | ||||||
|  | index c1cb330..f68a8c5 100644
 | ||||||
|  | --- a/tc.alloc.c
 | ||||||
|  | +++ b/tc.alloc.c
 | ||||||
|  | @@ -348,7 +348,7 @@ calloc(size_t i, size_t j)
 | ||||||
|  |  { | ||||||
|  |  #ifndef lint | ||||||
|  |      char *cp; | ||||||
|  | -    size_t k;
 | ||||||
|  | +    volatile size_t k;
 | ||||||
|  |   | ||||||
|  |      i *= j; | ||||||
|  |      cp = xmalloc(i); | ||||||
|  | -- 
 | ||||||
|  | 2.5.5 | ||||||
|  | 
 | ||||||
| @ -1,18 +0,0 @@ | |||||||
| diff --git a/tc.alloc.c b/tc.alloc.c
 |  | ||||||
| index b87f9e9..06e0405 100644
 |  | ||||||
| --- a/tc.alloc.c
 |  | ||||||
| +++ b/tc.alloc.c
 |  | ||||||
| @@ -348,10 +348,12 @@ calloc(size_t i, size_t j)
 |  | ||||||
|  { |  | ||||||
|  #ifndef lint |  | ||||||
|      char *cp; |  | ||||||
| +    volatile size_t k;
 |  | ||||||
|   |  | ||||||
|      i *= j; |  | ||||||
|      cp = xmalloc(i); |  | ||||||
| -    memset(cp, 0, i);
 |  | ||||||
| +    k = i;
 |  | ||||||
| +    memset(cp, 0, k);
 |  | ||||||
|   |  | ||||||
|      return ((memalign_t) cp); |  | ||||||
|  #else |  | ||||||
| @ -31,6 +31,7 @@ Source: ftp://ftp.astron.com/pub/tcsh/%{name}-%{version}.tar.gz | |||||||
| Patch000: tcsh-6.19.00-000-announcement.patch | Patch000: tcsh-6.19.00-000-announcement.patch | ||||||
| Patch001: tcsh-6.19.00-001-remove-CFLAGS-for-gethost.patch | Patch001: tcsh-6.19.00-001-remove-CFLAGS-for-gethost.patch | ||||||
| Patch002: tcsh-6.19.00-002-fix-error-messages.patch | Patch002: tcsh-6.19.00-002-fix-error-messages.patch | ||||||
|  | Patch003: tcsh-6.19.00-003-avoid-gcc5-calloc-optimization.patch | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # Downstream patches -- these should be always included when doing rebase: | # Downstream patches -- these should be always included when doing rebase: | ||||||
| @ -40,10 +41,8 @@ Patch100:  tcsh-6.19.00-manpage-memoryuse.patch | |||||||
| 
 | 
 | ||||||
| # Patches to be removed -- deprecated functionality which shall be removed at | # Patches to be removed -- deprecated functionality which shall be removed at | ||||||
| # ---------------------    some point in the future: | # ---------------------    some point in the future: | ||||||
| Patch101: tcsh-6.19.00-gcc5-calloc.patch |  | ||||||
| Patch102: tcsh-6.19.00-tcsh_posix_status-deprecated.patch | Patch102: tcsh-6.19.00-tcsh_posix_status-deprecated.patch | ||||||
| 
 | 
 | ||||||
| # NOTE: Patch101 has been accepted by upstream - http://mx.gw.com/pipermail/tcsh-bugs/2015-May/000944.html |  | ||||||
| # NOTE: Patch102 should be removed in Fedora 25! | # NOTE: Patch102 should be removed in Fedora 25! | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -156,6 +155,7 @@ fi | |||||||
|     tcsh-6.19.00-000-announcement.patch |     tcsh-6.19.00-000-announcement.patch | ||||||
|     tcsh-6.19.00-001-remove-CFLAGS-for-gethost.patch |     tcsh-6.19.00-001-remove-CFLAGS-for-gethost.patch | ||||||
|     tcsh-6.19.00-002-fix-error-messages.patch |     tcsh-6.19.00-002-fix-error-messages.patch | ||||||
|  |     tcsh-6.19.00-003-avoid-gcc5-calloc-optimization.patch (replaces tcsh-6.19.00-gcc5-calloc.patch) | ||||||
| 
 | 
 | ||||||
| * Thu Apr 21 2016 David Kaspar [Dee'Kej] <dkaspar@redhat.com> - 6.19.00-6 | * Thu Apr 21 2016 David Kaspar [Dee'Kej] <dkaspar@redhat.com> - 6.19.00-6 | ||||||
| - Drop tcsh-6.15.00-closem.patch - issue not reproducible, patch not accepted by upstream | - Drop tcsh-6.15.00-closem.patch - issue not reproducible, patch not accepted by upstream | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user