Skip to content

GCC Conversion Warnings #105

@phillipjohnston

Description

@phillipjohnston

GCC with -Wconversion highlights conversions that may change values.

[243/533] Compiling C object src/libc.a.p/.._printf_src_printf_printf.c.o
../printf/src/printf/printf.c: In function 'get_sign':
../printf/src/printf/printf.c:275:30: warning: conversion from 'double_uint_t' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
  275 |   return get_bit_access(x).U >> (DOUBLE_SIZE_IN_BITS - 1);
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../printf/src/printf/printf.c: In function 'get_components':
../printf/src/printf/printf.c:528:34: warning: conversion from 'int_fast64_t' {aka 'long long int'} to 'double' may change value [-Wconversion]
  528 |   double remainder = (abs_number - number_.integral) * powers_of_10[precision];
      |                                  ^
../printf/src/printf/printf.c:618:22: warning: conversion from 'int_fast64_t' {aka 'long long int'} to 'double' may change value [-Wconversion]
  618 |     scaled_remainder -= components.fractional;
      |                      ^~

I can resolve these in a PR with the proper casts, but I wanted you to take a look first in case you think some of them should be resolved through other means.

Metadata

Metadata

Assignees

Labels

resolved-on-developA changeset fixing this issue has been commiutted to the development branchtask

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions