[Issue 1977] Relax warnings (D1)/errors (D2) for implicit narrowing conversions caused by promotions

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1977

Iain Buclaw  changed:

   What|Removed |Added

   Priority|P2  |P4

--


[Issue 1977] Relax warnings (D1)/errors (D2) for implicit narrowing conversions caused by promotions

2015-06-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1977

Andrei Alexandrescu and...@erdani.com changed:

   What|Removed |Added

Version|unspecified |D2

--


[Issue 1977] Relax warnings (D1)/errors (D2) for implicit narrowing conversions caused by promotions

2012-10-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1977



--- Comment #26 from Ryuichi OHORI r.97...@gmail.com 2012-10-13 04:28:56 PDT 
---
 Your example is perfectly valid.
I don't see. In the example above( http://dpaste.dzfl.pl/8b9f5471 ), the value
in y is 16777216, which is greater than ushort.max.

 It knows the value of both x and y, so it knows that x |= y; will work just
 fine, because all of the values will fit in the correct types. If the value in
 y was too large to fit in a ushort, _then_ it should give you an error, but
 since it fits in a ushort just fine (and is positive, so there's no issues 
 with
 two's complement or whatnot), the compiler knows that it's fine and allows it
 without complaint.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 1977] Relax warnings (D1)/errors (D2) for implicit narrowing conversions caused by promotions

2012-10-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1977



--- Comment #28 from Ryuichi OHORI r.97...@gmail.com 2012-10-13 09:23:44 PDT 
---
(In reply to comment #27)
 reassigned to x because the result is only 4, which fits in a ushort just 
 fine.
The result is 16777220 if both operands are int.  I think this is an implicit
narrowing conversion.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 1977] Relax warnings (D1)/errors (D2) for implicit narrowing conversions caused by promotions

2012-10-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1977



--- Comment #29 from Jonathan M Davis jmdavisp...@gmx.com 2012-10-13 12:35:13 
PDT ---
 The result is 16777220 if both operands are int.  I think this is an implicit
narrowing conversion.

Ah. Then yes, it sounds like it's doing the wrong thing.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 1977] Relax warnings (D1)/errors (D2) for implicit narrowing conversions caused by promotions

2012-10-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1977


Ryuichi OHORI r.97...@gmail.com changed:

   What|Removed |Added

 CC||r.97...@gmail.com


--- Comment #24 from Ryuichi OHORI r.97...@gmail.com 2012-10-12 18:48:51 PDT 
---
I still has read not all of the this conversation, but I think my issue is
related to this.

trivially incorrect use of op assignment operator is allowed:
ushort |= int

http://dpaste.dzfl.pl/8b9f5471

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 1977] Relax warnings (D1)/errors (D2) for implicit narrowing conversions caused by promotions

2012-10-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1977


Jonathan M Davis jmdavisp...@gmx.com changed:

   What|Removed |Added

 CC||jmdavisp...@gmx.com


--- Comment #25 from Jonathan M Davis jmdavisp...@gmx.com 2012-10-12 19:42:37 
PDT ---
 trivially incorrect use of op assignment operator is allowed:

Your example is perfectly valid. D uses range value propagation:

http://www.drdobbs.com/tools/value-range-propagation/229300211

It knows the value of both x and y, so it knows that x |= y; will work just
fine, because all of the values will fit in the correct types. If the value in
y was too large to fit in a ushort, _then_ it should give you an error, but
since it fits in a ushort just fine (and is positive, so there's no issues with
two's complement or whatnot), the compiler knows that it's fine and allows it
without complaint.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 1977] Relax warnings (D1)/errors (D2) for implicit narrowing conversions caused by promotions

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1977





--- Comment #22 from Jason House jason.james.ho...@gmail.com  2009-08-08 
09:17:31 PDT ---
(In reply to comment #21)

I'm only worrying about D2 where implicit narrowing conversions is part of the
spec. ulong%1000 should implicitly allowed when assigning to an integer. Should
it be a distinct bugzilla entry?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 1977] Relax warnings (D1)/errors (D2) for implicit narrowing conversions caused by promotions

2009-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1977


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 CC||and...@metalanguage.com




--- Comment #23 from Andrei Alexandrescu and...@metalanguage.com  2009-08-08 
09:39:54 PDT ---
(In reply to comment #22)
 (In reply to comment #21)
 
 I'm only worrying about D2 where implicit narrowing conversions is part of the
 spec. ulong%1000 should implicitly allowed when assigning to an integer. 
 Should
 it be a distinct bugzilla entry?

Range value propagation, which was implemented recently, should take care of
this. It's among the simplest examples that should work with range value
propagation. The compiler must infer that a % 1000 has range -999 through 999
and therefore should allow it to fit in a short or int.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---