Bug 101559

Summary: konsole compile errors on amd64 with gcc4
Product: [Applications] konsole Reporter: Ana Guerrero (Debian KDE maintainers) <ana>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: konsole compile fixes for amd64/gcc4
patch for gcc4 fix

Description Ana Guerrero (Debian KDE maintainers) 2005-03-15 16:34:26 UTC
Version:            (using KDE KDE 3.4.0)
Installed from:    Debian testing/unstable Packages
Compiler:          gcc 4.0 prerelease 
OS:                Linux

A number of amd64/gcc4 compile fixes were posted to kde-devel a while ago, but not all were applied. One patch in particular (attached) (from http://lists.kde.org/?l=kde-core-devel&m=110651989125333&w=2 - this thread explains the problem in more detail) is still missing in konsole. Please apply the patch, and backport to 3_4_BRANCH as needed.

Thanks!
Comment 1 Ana Guerrero (Debian KDE maintainers) 2005-03-15 16:34:55 UTC
Created attachment 10131 [details]
konsole compile fixes for amd64/gcc4
Comment 2 Kurt Hindenburg 2005-03-15 19:39:39 UTC
Waldo changed the (int) to a (long) in Jan.  I/We thought that fixed this issue.

Revision 1.50  - (view) (download) (as text) (annotate) - [select for diffs]
Tue Jan 25 17:56:47 2005 UTC (7 weeks ago) by waba
Branch: MAIN
CVS Tags: HEAD, KDE_3_4_0_BETA_2, KDE_3_4_0_RELEASE
Branch point for: KDE_3_4_BRANCH
Changes since 1.49: +3 -3 lines
Diff to previous 1.49

gcc4/amd64 fix: Don't cast pointer to int, use long instead.





RCS file: /home/kde/kdebase/konsole/konsole/keytrans.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- kdebase/konsole/konsole/keytrans.cpp	2005/01/23 22:28:06	1.49
+++ kdebase/konsole/konsole/keytrans.cpp	2005/01/25 17:56:47	1.50
@@ -372,7 +372,7 @@
 //printf("line %3d: ",startofsym);
     getSymbol(); assertSyntax(sym == SYMName, "Name expected")
     assertSyntax(syms->keysyms[res], "Unknown key name")
-    int key = (int)syms->keysyms[res]-1;
+    int key = (long)( syms->keysyms[res] ) -1;
 //printf(" key %s (%04x)",res.latin1(),(int)syms->keysyms[res]-1);
     getSymbol(); // + - :
     int mode = 0;
@@ -384,7 +384,7 @@
       // mode name
       assertSyntax(sym == SYMName, "Name expected")
       assertSyntax(syms->modsyms[res], "Unknown mode name")
-      int bits = (int)syms->modsyms[res]-1;
+      int bits = (long)syms->modsyms[res]-1;
       if (mask & (1 << bits))
       {
         fprintf(stderr,"%s(%d,%d): mode name used multible times.\n",path.ascii(),slinno,scolno);
@@ -405,7 +405,7 @@
     if (sym == SYMName)
     {
       assertSyntax(syms->oprsyms[res], "Unknown operator name")
-      cmd = (int)syms->oprsyms[res]-1;
+      cmd = (long)syms->oprsyms[res]-1;
 //printf(": do %s(%d)",res.latin1(),(int)syms->oprsyms[res]-1);
     }
     if (sym == SYMString)
Comment 3 Ana Guerrero (Debian KDE maintainers) 2005-03-15 20:50:11 UTC
That's true, though Waldo's commit made only 3 of the 4 changes proposed in the original patch. Furthermore, the proposed patch was improved after suggestions by Thiago Macieira (the thread I linked to explains this). I've attached this improved patch, but modified to apply to HEAD.
Comment 4 Kurt Hindenburg 2005-03-16 06:35:20 UTC
| I've attached this improved patch, but modified to apply to HEAD. 

Where new patch?  I had to add #include <stddef.h> in order to compile on gcc3.3.5
Comment 5 Kurt Hindenburg 2005-03-17 19:52:46 UTC
Created attachment 10168 [details]
patch for gcc4 fix

This work for you?
Comment 6 Ana Guerrero (Debian KDE maintainers) 2005-03-19 16:22:13 UTC
Yes, it works here. Thanks!
Comment 7 Kurt Hindenburg 2005-03-28 21:38:43 UTC
CVS commit by hindenburg: 

Fix compile errors on amd64 with gcc4

BUG: 101559 


  M +5 -4      keytrans.cpp   1.51


--- kdebase/konsole/konsole/keytrans.cpp  #1.50:1.51
@@ -27,4 +27,5 @@
 
 #include <stdio.h>
+#include <stddef.h>
 
 #ifndef HERE
@@ -373,5 +374,5 @@ Loop:
     getSymbol(); assertSyntax(sym == SYMName, "Name expected")
     assertSyntax(syms->keysyms[res], "Unknown key name")
-    int key = (long)( syms->keysyms[res] ) -1;
+    ptrdiff_t key = (ptrdiff_t)(syms->keysyms[res]) - 1;
 //printf(" key %s (%04x)",res.latin1(),(int)syms->keysyms[res]-1);
     getSymbol(); // + - :
@@ -385,5 +386,5 @@ Loop:
       assertSyntax(sym == SYMName, "Name expected")
       assertSyntax(syms->modsyms[res], "Unknown mode name")
-      int bits = (long)syms->modsyms[res]-1;
+      ptrdiff_t bits = (ptrdiff_t)(syms->modsyms[res]) - 1;
       if (mask & (1 << bits))
       {
@@ -402,9 +403,9 @@ Loop:
     // string or command
     assertSyntax(sym == SYMName || sym == SYMString,"Command or string expected")
-    int cmd = 0;
+    ptrdiff_t cmd = 0;
     if (sym == SYMName)
     {
       assertSyntax(syms->oprsyms[res], "Unknown operator name")
-      cmd = (long)syms->oprsyms[res]-1;
+      cmd = (ptrdiff_t)(syms->oprsyms[res]) - 1;
 //printf(": do %s(%d)",res.latin1(),(int)syms->oprsyms[res]-1);
     }