https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85861
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING Last reconfirmed| |2018-05-21 Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- You didn't provide the output of `gcc -v` as required, but I suspect you're compiling for 32-bit, otherwise you'd get a warning: mozilla_jwakely0/main.c: In function 'int main()': mozilla_jwakely0/main.c:11:12: error: conversion to 'int' from 'size_t {aka long unsigned int}' may alter its value [-Werror=conversion] return converted; ^ cc1plus: all warnings being treated as errors For 32-bit where int and size_t are the same size you need to use -Wsign-conversion, as documented in the manual: Warnings about conversions between signed and unsigned integers are disabled by default in C++ unless -Wsign-conversion is explicitly enabled. https://godbolt.org/g/6J4rtS