Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile errors with gcc 6.1 #51

Closed
dns2utf8 opened this issue May 10, 2016 · 7 comments
Closed

Compile errors with gcc 6.1 #51

dns2utf8 opened this issue May 10, 2016 · 7 comments

Comments

@dns2utf8
Copy link

Hi all

I noticed gcc 6.1 can no longer build the miniz.c inside rust.
See: rust-lang/rust#33246

@SimonSapin
Copy link

This fixes the build for me with GCC 6.1.1.

diff --git a/src/rt/miniz.c b/src/rt/miniz.c
index 2b803b0..b3a453d 100644
--- a/src/rt/miniz.c
+++ b/src/rt/miniz.c
@@ -575,7 +575,10 @@ tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_nex
       {
         mz_uint8 *p = r->m_tables[0].m_code_size; mz_uint i;
         r->m_table_sizes[0] = 288; r->m_table_sizes[1] = 32; TINFL_MEMSET(r->m_tables[1].m_code_size, 5, 32);
-        for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8;
+        for ( i = 0; i <= 143; ++i) *p++ = 8;
+        for ( ; i <= 255; ++i) *p++ = 9;
+        for ( ; i <= 279; ++i) *p++ = 7;
+        for ( ; i <= 287; ++i) *p++ = 8;
       }
       else
       {
@@ -1393,7 +1396,10 @@ static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahe
         if ((d->m_dict[probe_pos + match_len] == c0) && (d->m_dict[probe_pos + match_len - 1] == c1)) break;
       TDEFL_PROBE; TDEFL_PROBE; TDEFL_PROBE;
     }
-    if (!dist) break; p = s; q = d->m_dict + probe_pos; for (probe_len = 0; probe_len < max_match_len; probe_len++) if (*p++ != *q++) break;
+    if (!dist) break;
+    p = s;
+    q = d->m_dict + probe_pos;
+    for (probe_len = 0; probe_len < max_match_len; probe_len++) if (*p++ != *q++) break;
     if (probe_len > match_len)
     {
       *pMatch_dist = dist; if ((*pMatch_len = match_len = probe_len) == max_match_len) return;

@paulharris
Copy link

You just had to add line breaks to fix it?

On 21 May 2016 at 00:31, Simon Sapin notifications@github.com wrote:

This fixes the build for me with GCC 6.1.1.

diff --git a/src/rt/miniz.c b/src/rt/miniz.c
index 2b803b0..b3a453d 100644--- a/src/rt/miniz.c+++ b/src/rt/miniz.c@@ -575,7 +575,10 @@ tinfl_status tinfl_decompress(tinfl_decompressor _r, const mz_uint8 *pIn_buf_nex
{
mz_uint8 *p = r->m_tables[0].m_code_size; mz_uint i;
r->m_table_sizes[0] = 288; r->m_table_sizes[1] = 32; TINFL_MEMSET(r->m_tables[1].m_code_size, 5, 32);- for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8;+ for ( i = 0; i <= 143; ++i) *p++ = 8;+ for ( ; i <= 255; ++i) *p++ = 9;+ for ( ; i <= 279; ++i) *p++ = 7;+ for ( ; i <= 287; ++i) *p++ = 8;
}
else
{@@ -1393,7 +1396,10 @@ static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahe
if ((d->m_dict[probe_pos + match_len] == c0) && (d->m_dict[probe_pos + match_len - 1] == c1)) break;
TDEFL_PROBE; TDEFL_PROBE; TDEFL_PROBE;
}- if (!dist) break; p = s; q = d->m_dict + probe_pos; for (probe_len = 0; probe_len < max_match_len; probe_len++) if (_p++ != _q++) break;+ if (!dist) break;+ p = s;+ q = d->m_dict + probe_pos;+ for (probe_len = 0; probe_len < max_match_len; probe_len++) if (_p++ != _q++) break;
if (probe_len > match_len)
{
*pMatch_dist = dist; if ((_pMatch_len = match_len = probe_len) == max_match_len) return;


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#51 (comment)

@SimonSapin
Copy link

Yes, exactly.

@SimonSapin
Copy link

The error message is

this ‘for’ clause does not guard this statement, but the latter is misleadingly indented as if it is guarded by the ‘for’

So the program would behave correctly if this check was simply disabled. But line breaks do make it much easier to read for humans.

@dns2utf8
Copy link
Author

I made a PR: #52

@dns2utf8
Copy link
Author

So I think this will not be merged?

@uroni
Copy link
Collaborator

uroni commented Mar 11, 2017

Should be fixed now with 2.x

@uroni uroni closed this as completed Mar 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants