BUILD: tools: work around an internal compiler bug in gcc-3.4

gcc-3.4 fails to compile standard.c :

src/standard.c: In function `str2sa_range':
src/standard.c:1034: error: unrecognizable insn:
(insn 582 581 583 37 src/standard.c:949 (set (reg/f:SI 262)
        (high:SI (const:SI (plus:SI (symbol_ref:SI ("*ss.4") [flags 0x22] <var_decl fe782e80 ss>)
                    (const_int 2 [0x2]))))) -1 (nil)
    (nil))
src/standard.c:1034: internal compiler error: in extract_insn, at recog.c:2083

The workaround is explained here :

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21613

It only requires creating a local variable containing the result of the
cast, which is totally harmless, so let's do it.
This commit is contained in:
Willy Tarreau 2019-06-16 18:16:33 +02:00
parent c31e5a5126
commit 8daa920ae4
1 changed files with 5 additions and 4 deletions

View File

@ -928,6 +928,7 @@ struct sockaddr_storage *str2sa_range(const char *str, int *port, int *low, int
ss.ss_family = AF_UNSPEC;
}
else if (ss.ss_family == AF_UNIX) {
struct sockaddr_un *un = (struct sockaddr_un *)&ss;
int prefix_path_len;
int max_path_len;
int adr_len;
@ -936,7 +937,7 @@ struct sockaddr_storage *str2sa_range(const char *str, int *port, int *low, int
* <unix_bind_prefix><path>.<pid>.<bak|tmp>
*/
prefix_path_len = (pfx && !abstract) ? strlen(pfx) : 0;
max_path_len = (sizeof(((struct sockaddr_un *)&ss)->sun_path) - 1) -
max_path_len = (sizeof(un->sun_path) - 1) -
(prefix_path_len ? prefix_path_len + 1 + 5 + 1 + 3 : 0);
adr_len = strlen(str2);
@ -946,10 +947,10 @@ struct sockaddr_storage *str2sa_range(const char *str, int *port, int *low, int
}
/* when abstract==1, we skip the first zero and copy all bytes except the trailing zero */
memset(((struct sockaddr_un *)&ss)->sun_path, 0, sizeof(((struct sockaddr_un *)&ss)->sun_path));
memset(un->sun_path, 0, sizeof(un->sun_path));
if (prefix_path_len)
memcpy(((struct sockaddr_un *)&ss)->sun_path, pfx, prefix_path_len);
memcpy(((struct sockaddr_un *)&ss)->sun_path + prefix_path_len + abstract, str2, adr_len + 1 - abstract);
memcpy(un->sun_path, pfx, prefix_path_len);
memcpy(un->sun_path + prefix_path_len + abstract, str2, adr_len + 1 - abstract);
}
else { /* IPv4 and IPv6 */
char *end = str2 + strlen(str2);