This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/49360] generate wrong logic code
- From: "wuxb45 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 10 Jun 2011 06:29:04 +0000
- Subject: [Bug c/49360] generate wrong logic code
- Auto-submitted: auto-generated
- References: <bug-49360-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49360
Wu Xingbo <wuxb45 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |mipsel-gnu-linux
Host| |Fedora 15 x86_64
Build| |Fedora 15 x86_64
--- Comment #1 from Wu Xingbo <wuxb45 at gmail dot com> 2011-06-10 06:29:00 UTC ---
long lcm(long num1,long num2)
{
int a, b, temp;
/***********here*************/
if(num1<num2) /*want n1>n2*/
{
temp=num1;
num1=num2;
num2=temp; /*swap*/
}
/****************************/
/***generates the logic:*****/
if(!(num1<num2))
{
temp=num1;
num1=num2;
num2=temp; /*swap*/
}
a=num1;//big
b=num2;//small
while(b!=0) /*gcd*/
{
temp=a%b;
a=b;
b=temp;
}
return num1*num2 / a;
}