https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90219
Bug ID: 90219 Summary: Wrong source location for "cannot convert to a pointer type" warning Product: gcc Version: 8.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: tbaeder at redhat dot com Target Milestone: --- Using gcc 8.3.1 and the following sample code: static int use_float(float *f) { return (int)*f; } // Type your code here, or load an example. int square(int num) { float f = 1.0f; return use_float((float*)f); } it prints the following error: <source>: In function 'square': <source>:8:5: error: cannot convert to a pointer type return use_float((float*)f); ^~~~~~ which is highlighting the wrong part of that line. The error message itself could be improved as well (I forgot to take the address of f of course!) but I think the cast should be highlighted. If use_float() is instead called stand-alone and not as part of the return statment: int square(int num) { float f = 1.0f; use_float((float*)f); return 1; } The source location is slightly better: <source>: In function 'square': <source>:8:5: error: cannot convert to a pointer type use_float((float*)f); ^~~~~~~~~