3

I'm building in debug mode, not release, yet it loses track of variables. See below where the value of nx seems lost, the way you might expect if you were trying to debug an optimized build. Is this a bug in Xcode or am I doing something wrong?

enter image description here

enter image description here

enter image description here

Rob N
  • 15,024
  • 17
  • 92
  • 165

1 Answers1

0

Compilers do sometimes drop debug information for "unused identifiers". Debug information can quickly get huge, so even at -O0 compilers have to do some work to ensure that they don't emit more info than needed. Defining "needed" is trickier said than done, but surely it should keep all local var's and let's.

So it seems to me this one is worth filing a bug on the swift compiler. It's particularly odd that swiftc emits debug information for ny but not nx. Do you use ny more later on in the function?

If you do file a bug please include a buildable .swift file or project that shows the bug.

Jim Ingham
  • 25,260
  • 2
  • 55
  • 63