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

Compilation errors when building rust with GCC 6.1 #33246

Closed
rjammala opened this issue Apr 27, 2016 · 16 comments
Closed

Compilation errors when building rust with GCC 6.1 #33246

rjammala opened this issue Apr 27, 2016 · 16 comments
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@rjammala
Copy link

rjammala commented Apr 27, 2016

Here is what I get when I clone rust from github and try to build it with GCC 6.1:

rjammalamadaka/rust/src/rt/miniz.c: In function ‘tinfl_decompress’:
rjammalamadaka/rust/src/rt/miniz.c:578:9: error: this ‘for’ clause does not guard... [-Werror=misleading-indentation]
         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;
         ^~~
rjammalamadaka/rust/src/rt/miniz.c:578:47: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘for’
         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;
                                               ^~~
rjammalamadaka/rust/src/rt/miniz.c: In function ‘tdefl_find_match’:
rjammalamadaka/rust/src/rt/miniz.c:1396:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
     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;
     ^~
rjammalamadaka/rust/src/rt/miniz.c:1396:23: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
     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;
@nagisa
Copy link
Member

nagisa commented Apr 27, 2016

NOTE: I edited you message to format the report.

@durka
Copy link
Contributor

durka commented Apr 28, 2016

Should we fix the code, or just turn off the warning? It looks like miniz.c was imported wholesale from somewhere else...

@frewsxcv
Copy link
Member

frewsxcv commented Apr 29, 2016

Worth mentioning that we don't have the latest version in-tree:

https://github.com/rust-lang/rust/blob/master/src/rt/miniz.c

https://github.com/richgel999/miniz/blob/master/miniz.c

@adelarsq
Copy link

@alexcrichton Just to know. Any reason to avoid a update for the miniz.c file?

@alexcrichton
Copy link
Member

Nah should be fine to update!

@alexcrichton
Copy link
Member

@bors: retry

On Fri, Apr 29, 2016 at 5:35 PM, Adelar da Silva Queiróz <
notifications@github.com> wrote:

@alexcrichton https://github.com/alexcrichton Just to know. Any reason
to avoid a update for the miniz.c file?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#33246 (comment)

@dns2utf8
Copy link
Contributor

I updated the miniz.c locally, but it did not compile with gcc 6.1.1.
I am compiling with clang 3.7.1 now with the updated file, works so far.

@MagaTailor
Copy link

MagaTailor commented May 10, 2016

No problem on ARM using gcc 6.1.0, go figure. And I didn't pass -Wno-error anywhere.

Edit:
No wait, gcc was bootstrapped with --disable-werror

@dns2utf8
Copy link
Contributor

dns2utf8 commented May 10, 2016

I was able to build the compiler and the docs with clang and I opened a issue on richgel999/miniz#51.

@MagaTailor
Copy link

Likewise with gcc, just add -Wno-error to your CFLAGS for now.

@SimonSapin
Copy link
Contributor

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;

@dns2utf8
Copy link
Contributor

There is a PR addressing this: #33798

@dns2utf8
Copy link
Contributor

And I made a PR to upstream: richgel999/miniz#52
Maybe upgrade miniz after it is merged.

Regards

@tbu-
Copy link
Contributor

tbu- commented May 30, 2016

Fixed by #33798.

@Keruspe
Copy link
Contributor

Keruspe commented May 30, 2016

There's still another compilation failure with gcc 6 here

/var/tmp/paludis/build/dev-lang-rust-1.9.0-r1/work/rustc-1.9.0/src/rt/hoedown/src/document.c: In function 'char_link':
/var/tmp/paludis/build/dev-lang-rust-1.9.0-r1/work/rustc-1.9.0/src/rt/hoedown/src/document.c:1161:5: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
     else nb_p--; i++;
     ^~~~
/var/tmp/paludis/build/dev-lang-rust-1.9.0-r1/work/rustc-1.9.0/src/rt/hoedown/src/document.c:1161:18: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else'
     else nb_p--; i++;
                  ^
        ^ 

@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 25, 2017
@steveklabnik
Copy link
Member

We have since removed hoedown as well. Is anyone still seeing this issue? I believe it can be closed.

@jonas-schievink jonas-schievink added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) and removed T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) A-build labels Apr 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests