[Bug c++/87519] New: -Wsign-conversion erroneosly triggered when converting to auto-deduced interger type

2018-10-04 Thread fefer.ivan at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

Bug ID: 87519
   Summary: -Wsign-conversion erroneosly triggered when converting
to auto-deduced interger type
   Product: gcc
   Version: 7.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fefer.ivan at gmail dot com
  Target Milestone: ---

Created attachment 44785
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44785&action=edit
Minimal source code that triggers the bug

Version and system: gcc version 7.3.0 (Ubuntu 7.3.0-21ubuntu1~16.04)
Command line: gcc -v -save-temps -Werror -Wsign-conversion --std=c++17 bug.cpp
Full source  code and

[Bug c++/87519] -Wsign-conversion erroneosly triggered when converting to auto-deduced interger type

2018-10-04 Thread fefer.ivan at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

--- Comment #1 from Ivan Fefer  ---
Created attachment 44786
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44786&action=edit
Full stderr of compiler

[Bug c++/87519] -Wsign-conversion erroneosly triggered when converting to auto-deduced interger type

2018-10-04 Thread fefer.ivan at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

--- Comment #2 from Ivan Fefer  ---
Created attachment 44787
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44787&action=edit
Code after preprocessing

[Bug c++/87519] -Wsign-conversion erroneosly triggered when converting to auto-deduced interger type

2018-10-04 Thread fefer.ivan at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

--- Comment #3 from Ivan Fefer  ---
Created attachment 44788
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44788&action=edit
Temp compiler file

[Bug c++/87519] -Wsign-conversion erroneosly triggered when converting to auto-deduced interger type

2018-10-04 Thread fefer.ivan at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

--- Comment #4 from Ivan Fefer  ---
Sorry, hit the Submit button too early by accident.

Source code and compiler output are attached.

Bug is -Wsign-conversion warning triggerring:

bug.cpp:5:11: error: conversion to ‘long unsigned int’ from ‘int32_t {aka int}’
may change the sign of the result [-Werror=sign-conversion]
   r = r + static_cast(q);
   ^~~~

in function 

void f(uint64_t a, int32_t q) {
  auto& r = a;
  r = r + static_cast(q);
}

If we replace 'auto& r = a' with 'uint64_t& r = a' warning with disappear.

[Bug c++/87519] -Wsign-conversion erroneosly triggered when converting to auto-deduced interger type

2018-10-04 Thread fefer.ivan at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

--- Comment #5 from Ivan Fefer  ---
Same code at Godbolt.org: https://gcc.godbolt.org/

[Bug c++/87519] -Wsign-conversion erroneosly triggered when converting to auto-deduced interger type

2018-10-04 Thread fefer.ivan at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

--- Comment #6 from Ivan Fefer  ---
https://gcc.godbolt.org/z/hOpMyc