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

gcc-4.7 regression in 1bdaf9c8 #3554

Closed
dabroz opened this issue Mar 28, 2017 · 0 comments
Closed

gcc-4.7 regression in 1bdaf9c8 #3554

dabroz opened this issue Mar 28, 2017 · 0 comments

Comments

@dabroz
Copy link
Contributor

dabroz commented Mar 28, 2017

1bdaf9c introduced a problem that prevents gcc-4.7 (and other setups) from compiling mruby.

"gcc-4.7" -m32 -DMRB_INT64=1 -g3 -O0 -DMRB_DEBUG -DMRBGEM_MRUBY_ARRAY_EXT_VERSION=0.0.0 -I"/builds/dabroz/mruby/include" -MMD -o "/builds/dabroz/mruby/build/host/mrbgems/mruby-array-ext/src/array.o" -c "/builds/dabroz/mruby/mrbgems/mruby-array-ext/src/array.c"
/builds/dabroz/mruby/mrbgems/mruby-array-ext/src/array.c: In function 'mrb_ary_slice_bang':
/builds/dabroz/mruby/mrbgems/mruby-array-ext/src/array.c:213:3: error: 'for' loop initial declarations are only allowed in C99 mode
/builds/dabroz/mruby/mrbgems/mruby-array-ext/src/array.c:213:3: note: use option -std=c99 or -std=gnu99 to compile your code
/builds/dabroz/mruby/mrbgems/mruby-array-ext/src/array.c:218:16: error: redefinition of 'j'
/builds/dabroz/mruby/mrbgems/mruby-array-ext/src/array.c:213:16: note: previous definition of 'j' was here
/builds/dabroz/mruby/mrbgems/mruby-array-ext/src/array.c:218:3: error: 'for' loop initial declarations are only allowed in C99 mode

Problematic lines:

213  for (mrb_int j = i, k = 0; k < len; ++j, ++k) {
214    mrb_ary_push(mrb, ary, a->ptr[j]);
215  }
216
217  ptr = a->ptr + i;
218  for (mrb_int j = i; j <= a->len - len; ++j) {
219    *ptr = *(ptr+len);
220    ++ptr;
221  }
@matz matz closed this as completed in 5ec051f Mar 28, 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

1 participant