This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/5969: When function is declared func(unsigned char v), v isn't truncated
- From: dberlin at sources dot redhat dot com
- To: dash at xdr dot com, dberlin at sources dot redhat dot com, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: 16 Mar 2002 23:01:56 -0000
- Subject: Re: optimization/5969: When function is declared func(unsigned char v), v isn't truncated
- Reply-to: dberlin at sources dot redhat dot com, dash at xdr dot com, dberlin at sources dot redhat dot com, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: When function is declared func(unsigned char v), v isn't truncated
Responsible-Changed-From-To: unassigned->dberlin
Responsible-Changed-By: dberlin
Responsible-Changed-When: Sat Mar 16 15:01:56 2002
Responsible-Changed-Why:
Me
State-Changed-From-To: open->feedback
State-Changed-By: dberlin
State-Changed-When: Sat Mar 16 15:01:56 2002
State-Changed-Why:
You have implicitly declared tst to take an int by using it before it's defined.
Because it is inlined into main at -O2, and at that point it thinks it takes an int, it never performs the truncation.
Any code after the tst function is defined to take an unsigned char will do the truncation.
The problem is the code, not the compiler, AFAIK.
The title of the bug report is misleading, you haven't declared func(unsigned char v), if you did, the problem would go away.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5969