Author Topic: MSVC 32-bit generation bug  (Read 235 times)

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 2039
    • View Profile
MSVC 32-bit generation bug
« on: June 07, 2024, 08:36:20 AM »
I stated the following when I uploaded BCX version 8.1.0:

Quote

For reasons I've not uncovered, MSVC-2022 would not compile a functional 32-bit version of Bc.exe today.
All other compilers produced functional 32-bit and 64-bit versions.



I'm pleased to report that I've sorted out the problem.

* I am running the latest MS Visual Studio updates: ver.  17.8

* For many years, I have compiled using the /O2 optimization switch for both 32-bit and 64-bit generation

* I discovered today that removing the /O2 optimization produces a functional 32-bit version of BCX 8.1.0

* When I use the latest version of the Clang compiler with the latest version of the Visual Studio headers and libs,
   the resulting 32-bit version of BCX works as it should.  This suggests to me that the issue lies with Microsoft's current
   32-bit compiler or linker.

* I've removed the /O2 switch from my personal VC32.bat, Vw32.bat, and VD32.bat files. 

   

« Last Edit: June 07, 2024, 09:16:11 AM by MrBcx »

jbk

  • Full Member
  • ***
  • Posts: 211
    • View Profile
Re: MSVC 32-bit generation bug
« Reply #1 on: June 07, 2024, 10:31:35 AM »
I am curious about the 32-bit msvc build of BC, what was wrong with it?
did it crash or produce wrong code?

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 2039
    • View Profile
Re: MSVC 32-bit generation bug
« Reply #2 on: June 07, 2024, 11:21:08 AM »
I am curious about the 32-bit msvc build of BC, what was wrong with it?
did it crash or produce wrong code?

Rebuilding BCX requires 3 compiles.  The first translation requires a correctly functioning version of BC.exe.

The first MSVC 32-bit compile/link would generate a flawed Bc.exe executable which was unable to produce any output.

Full stop.  Dead in the water.  Do not pass go, do not collect $200.

When I removed the /O2 optimization switch, I found my bliss.




« Last Edit: June 07, 2024, 12:07:46 PM by MrBcx »

jbk

  • Full Member
  • ***
  • Posts: 211
    • View Profile
Re: MSVC 32-bit generation bug
« Reply #3 on: June 07, 2024, 01:16:10 PM »
thank you  :)

morgan

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: MSVC 32-bit generation bug
« Reply #4 on: June 09, 2024, 01:29:05 AM »
it might be a bug in bcx, that arrised in optimization mode.
you can verify this, by building an optimized bcx with g++

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 2039
    • View Profile
Re: MSVC 32-bit generation bug
« Reply #5 on: June 09, 2024, 09:29:23 AM »
it might be a bug in bcx, that arrised in optimization mode.
you can verify this, by building an optimized bcx with g++

Yes ... I did that days ago. 

Pelles, Embarcadero, Mingw, and Clang all successfully compiled BCX as 32-bit model with optimizations enabled.

I'm still sorting things out.