[HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Csonicgo
Posts: 1193
Joined: Thu Apr 15, 2004 3:28 pm
Location: Leeds

[HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp

Post by Csonicgo »

https://github.com/rheit/zdoom/blob/6d4 ... t.cpp#L159
https://github.com/rheit/zdoom/blob/6d4 ... t.cpp#L153

These two lines in this block of code:

Code: Select all

		// We don't handle these. :(
		case DTA_DestWidth:
		case DTA_DestHeight:
			*(DWORD *)tags = TAG_IGNORE;   <--
			data = va_arg (tags, DWORD);
			break;

		// Translation is specified explicitly by the text.
		case DTA_Translation:
			*(DWORD *)tags = TAG_IGNORE;  <--
			ptrval = va_arg (tags, void*);
			break;
may cause an error on compilation on non x86-64 platforms, because type va_list cannot be cast to DWORD* (aka an unsigned int*) .

Solution: Change these offending lines to:

Code: Select all

assert(false && "unsupported");
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp

Post by Graf Zahl »

Csonicgo wrote:Solution: Change these offending lines to:

Code: Select all

assert(false && "unsupported");

What does that solve? It only breaks the code.
Blzut3
 
 
Posts: 3209
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp

Post by Blzut3 »

The offending lines are disabling invalid input before passing the tags off to character drawing. Unless I'm missing something (my test case for the change suggested was ECWolf's Android port, I imagine Beloko did the same for GZDoom's Android port), using asserts here is harmless since you should never input those values when drawing text.
User avatar
Csonicgo
Posts: 1193
Joined: Thu Apr 15, 2004 3:28 pm
Location: Leeds

Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp

Post by Csonicgo »

Graf Zahl wrote:
Csonicgo wrote:Solution: Change these offending lines to:

Code: Select all

assert(false && "unsupported");

What does that solve? It only breaks the code.
Is there a better solution to this? This is the only showstopper in the code that prevents ARM compilation as far as I can tell.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp

Post by Graf Zahl »

That code is still needed so just silencing the error and ignoring the problem is not going to help matters.
Blzut3
 
 
Posts: 3209
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp

Post by Blzut3 »

Graf Zahl wrote:That code is still needed so just silencing the error and ignoring the problem is not going to help matters.
Mind to give me a line #? I don't see any calls to DrawText that use these tags, which makes sense since they appear to be no-ops.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp

Post by Graf Zahl »

You are correct. These are never used by any DrawText call. I just replaced the offending code with an 'assert(false)'. Using these should be forbidden as they don't work anyway.
Edward-san
Posts: 1774
Joined: Sat Oct 17, 2009 9:40 am

Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp

Post by Edward-san »

but in a release build, the 'assert' is simplified ... what about a 'I_(Fatal?)Error' call?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [HEAD] (ARM) GCC 4.6.2: invalid casts in v_text.cpp

Post by Graf Zahl »

This should be caught during development - and any new addition here will inevitably trigger the assert - and immediately be removed.
Post Reply

Return to “Closed Bugs [GZDoom]”