Skip to content

Fix GCC 15 warnings (shift-negative-value, pointer-to-int-cast) - #113

Open
Bwooce wants to merge 2 commits into
bitbank2:masterfrom
Bwooce:fix/gcc15-warnings
Open

Fix GCC 15 warnings (shift-negative-value, pointer-to-int-cast)#113
Bwooce wants to merge 2 commits into
bitbank2:masterfrom
Bwooce:fix/gcc15-warnings

Conversation

@Bwooce

@Bwooce Bwooce commented Jan 27, 2026

Copy link
Copy Markdown

Fixed implicit left shift of negative value and pointer-to-int cast warnings treated as errors in GCC 15.\n\nChanges:\n- Cast -1 to uint32_t before left shifting to avoid negative value shift.\n- Use intptr_t for pointer casting to avoid pointer-to-int-cast warnings/errors.\n- Initialize xmmIn variable to avoid uninitialized usage warning.

@Bwooce

Bwooce commented Jan 27, 2026

Copy link
Copy Markdown
Author

Verified compilation and execution with Clang 18 on Linux. No warnings observed.

@Bwooce

Bwooce commented Jan 27, 2026

Copy link
Copy Markdown
Author

Additional testing: Verified decoding of external standard test image (landscape.jpg, 1800x1200). 'small.jpg' (minimal 107 bytes) failed with INVALID_FILE, likely due to strict header requirements or missing tables.

@Bwooce

Bwooce commented Jan 27, 2026

Copy link
Copy Markdown
Author

Definitive testing: Downloaded official IJG test images (jpeg-9e). Successfully decoded 'testimg.jpg' (baseline) and 'testimgp.jpg' (progressive).

Comment thread src/jpeg.inl
@Bwooce

Bwooce commented Jan 27, 2026

Copy link
Copy Markdown
Author

Reverted the pointer cast changes (restored original int64_t cast) as they were likely unnecessary/incorrect. Kept the shift-negative-value and uninitialized variable fixes.

@Bwooce

Bwooce commented Jan 27, 2026

Copy link
Copy Markdown
Author

Final Verification: Confirmed compilation with GCC 15.2.0 (riscv32-esp-elf-g++) using -Wall -Werror. The code is clean and the earlier reported GCC 15 issues are fully resolved.

@Bwooce

Bwooce commented Jan 27, 2026

Copy link
Copy Markdown
Author

(and full disclosure, PR driven with Claude. The reason this PR exists is that ESP32 IDF 6.0 uses GCC 15, and so projects using it + warnings-as-errors start failing due to the new warnings).

The new initialisation surely has some overhead, and I don't think I'm versed enough in compiler vs undefined behaviour to know if was 100% safe before.

@Bwooce

Bwooce commented Feb 21, 2026

Copy link
Copy Markdown
Author

got a moment to review @bitbank2 ? Alternatively I can turn off warnings-as-errors in epdiy but that doesn't seem like a great path.

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

Successfully merging this pull request may close these issues.

1 participant