Bug #3871


fix issues introduced by 3604

Added by Richard Yao almost 9 years ago. Updated about 5 years ago.

zfs - Zettabyte File System
Start date:
Due date:
% Done:


Estimated time:
Gerrit CR:


GCC 4.5.3 on Gentoo Linux did not like a few of the changes made in the issue 3604 patch. It printed an error and a couple of warnings:

../../cmd/zdb/zdb.c: In function 'dump_bpobj':
../../cmd/zdb/zdb.c:1257:3: error: 'for' loop initial declarations are only allowed in C99 mode
../../cmd/zdb/zdb.c:1257:3: note: use option -std=c99 or -std=gnu99 to compile your code
../../cmd/zdb/zdb.c: In function 'dump_deadlist':
../../cmd/zdb/zdb.c:1323:8: warning: too many arguments for format
../../cmd/zdb/zdb.c:1323:8: warning: too many arguments for format

I have attached a patch to fix these issues. It is against a development branch where I am merging changes from Illumos into the ZFSOnLinux codebase for testing purposes. It is against a single file, so it should be easy to apply to Illumos.


patch (1.7 KB) patch Patch to fix issues Richard Yao, 2013-07-06 05:18 PM
Actions #1

Updated by Igor Pashev almost 9 years ago

2013. Time to use C99. C99 is good :-)

Actions #2

Updated by Richard Yao almost 9 years ago

Igor Pashev wrote:

2013. Time to use C99. C99 is good :-)

There are two problems here. One is that the use of a variable declaration inside a for loop is inconsistent with the rest of the code. This is a Linux-specific problem because ZFSOnLinux is not telling GCC to use C99, but that has worked so far. The other is that there is an incorrect format string.

At least the format string should be fixed. With that said, using variable declarations inside a single for loop when the rest of the code has avoided it seems like a regression.

Actions #3

Updated by Yuri Pankov over 5 years ago

  • Subject changed from GCC 4.5.3 does not like issue 3604 patch to fix issues introduced by 3604
  • Status changed from New to In Progress
  • Assignee set to Yuri Pankov
  • % Done changed from 0 to 50
  • Tags deleted (needs-triage)
Actions #4

Updated by Electric Monk about 5 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 50 to 100

git commit de05b58863498b10283637eb9ac85e92fe85150e

commit  de05b58863498b10283637eb9ac85e92fe85150e
Author: Richard Yao <>
Date:   2017-04-07T21:14:46.000Z

    3871 fix issues introduced by 3604
    Reviewed by: Paul Dagnelie <>
    Reviewed by: Matthew Ahrens <>
    Reviewed by: Serapheim Dimitropoulos <>
    Approved by: Dan McDonald <>


Also available in: Atom PDF