www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4176] New: Link error when case range covers 4 or more cases.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4176

           Summary: Link error when case range covers 4 or more cases.
           Product: D
           Version: 2.031
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: link-failure
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au



void bug4176(int x) {
   switch(x){    
   case 1: .. case 4:
       break;
   }   
}
================
OPTLINK (R) for Win32  Release 8.00.1
Copyright (C) Digital Mars 1989-2004  All rights reserved.
OPTLINK : Warning 23: No Stack
arr.obj(arr)
 Error 42: Symbol Undefined __d_switch_error
--- errorlevel 1

================
Doesn't happen if the range is "case 1: .. case 3:"
or if you add a "default:"

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 11 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4176


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.031                       |0.145
            Summary|Link error when case range  |Link error in switch with 4
                   |covers 4 or more cases.     |or more cases and no
                   |                            |default



Actually it doesn't need case range. It happens even on prehistoric releases of
DMD (I tested DMD 0.140).

void bug4176(int x)
{
   switch(x)
   {    
   case 1:
   case 2:
   case 3:
   case 4:
        break;
   }   
}

If you compile with -w, you get a "no default" warning, so it doesn't reach the
linker.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 12 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4176


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com



08:48:36 PDT ---
This error only happens if you're missing the 'main' function. The most recent
Optlink version gives these errors:

OPTLINK : Warning 23: No Stack
errorswitch.obj(errorswitch)
 Error 42: Symbol Undefined __d_switch_error
OPTLINK : Warning 134: No Start Address
--- errorlevel 1

Not sure why the error about the switch is there, but it certainly won't link
without main, so there's no damage done here right?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 19 2011