Bug 314174 (MONO55901) - We do not do complete folding of string concating
Summary: We do not do complete folding of string concating
Status: RESOLVED MOVED
Alias: MONO55901
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Enhancement
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-22 19:39 UTC by Ben Maurer
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:31:06 UTC


---- Reported by bmaurer@users.sf.net 2004-03-22 12:39:25 MST ----

If you compile the following code:

using System;

class T {
	static void Main ()
	{
		string name = "foo";
		Console.WriteLine ("Enumerator value for '" + name + "' is too large to " +
		                   "fit in its type");
	}
}

the il code is:

     IL_0000:  ldstr "foo"
        IL_0005:  stloc.0
        IL_0006:  ldstr "Enumerator value for '"
        IL_000b:  ldloc.0
        IL_000c:  ldstr "' is too large to "
        IL_0011:  ldstr "fit in its type"
        IL_0016:  call string valuetype
[mscorlib]'System.String'::'Concat'(string, string, string, string)
        IL_001b:  call void class
[mscorlib]'System.Console'::'WriteLine'(string)
        IL_0020:  ret


        IL_000c:  ldstr "' is too large to "
        IL_0011:  ldstr "fit in its type"
        IL_0016:  call string valuetype
[mscorlib]'System.String'::'Concat'(string, string, string, string)

is redundant, the string should be folded at compile time, so that you have:


        IL_000c:  ldstr "' is too large to fit in its type"

and then concat with 3 arguments.



---- Additional Comments From bmaurer@users.sf.net 2004-03-22 22:03:53 MST ----

Not really a dup, but the same patch does both things.

*** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO55906 ***


Unknown operating system unknown. Setting to default OS "Other".
This bug was marked DUPLICATE in the database it was moved from.
    Changing resolution to "MOVED"