This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: difference in calculation result when using gcc vs Visual studio and optimisation flag
- From: Игорь Сотниченко <igor dot sotnichenko at gmail dot com>
- To: gcc-help at gcc dot gnu dot org, Jonathan Wakely <jwakely dot gcc at gmail dot com>, Mason <slash dot tmp at free dot fr>, ryxi at stu dot xidian dot edu dot cn, aph at redhat dot com
- Date: Thu, 24 May 2018 14:33:13 +0500
- Subject: Re: difference in calculation result when using gcc vs Visual studio and optimisation flag
- References: <CAAo4jWMKpaw7NUFx1+=k6t_sbCvUEOMr19sjy0YB7USKcujSsw@mail.gmail.com>
Good afternoon!
The problem was in code part where I used the type "unsigned long" (linux 8
bytes, windows 4 bytes).
Type replaced with "unsigned int"
Why when I have turned off the optimization (O0)the error does not appear?
2018-04-25 16:27 GMT+05:00 Игорь Сотниченко <igor.sotnichenko@gmail.com>:
> Hello!
>
> 1. There is a decent difference between calculations on Visual
> studio compiler and gcc 7.1 in calculation result of my program.
>
> 2. When optimization in gcc are disabled, then there is no
> difference.
>
> 3. When I have replaced O2 with keys from O1 and O2 (
> https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html), then there is
> no difference in results, but there is a calculation speed degradation
> compared to O2.
>
>
>