[Bug bzip2/34272] New: bzip2recover: Fix compiler warning due to non-standard %Lu format modifier

pepe.schlehofer at gmail dot com sourceware-bugzilla@sourceware.org
Tue Jun 9 09:46:32 GMT 2026


https://sourceware.org/bugzilla/show_bug.cgi?id=34272

            Bug ID: 34272
           Summary: bzip2recover: Fix compiler warning due to non-standard
                    %Lu format modifier
           Product: bzip2
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: bzip2
          Assignee: nobody at sourceware dot org
          Reporter: pepe.schlehofer at gmail dot com
                CC: bzip2-devel at sourceware dot org
  Target Milestone: ---

Created attachment 16781
  --> https://sourceware.org/bugzilla/attachment.cgi?id=16781&action=edit
Fixes warning

When compiling bzip2recover.c with modern compilers (such as Clang on macOS),
the following warning is emitted:
bzip2recover.c:376:59: warning: length modifier 'L' results in undefined
behavior or no effect with 'u' conversion specifier [-Wformat]
  376 |                fprintf ( stderr, "   block %d runs from "
MaybeUInt64_FMT 
      |                                                          
^~~~~~~~~~~~~~~
bzip2recover.c:40:29: note: expanded from macro 'MaybeUInt64_FMT'
   40 | #  define MaybeUInt64_FMT "%Lu"
      |                            ~^~
bzip2recover.c:376:59: note: did you mean to use 'll'?

The C standard defines 'll' as the length modifier for long long types, while
'L' is reserved for long double. 

Using %Lu for long long unsigned integers is non-standard and causes warnings
or potential undefined behavior.
Fix this by changing the MaybeUInt64_FMT macro in bzip2recover.c to use the
standard "%llu" format specifier when compiling with GCC/Clang.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Bzip2-devel mailing list