Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 786288 - games-fps/darkplaces-20140513-r1 - ../.../dpsoftrast.c: error: size of array element is not a multiple of its alignment
Summary: games-fps/darkplaces-20140513-r1 - ../.../dpsoftrast.c: error: size of array ...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Games
Keywords: PATCH
Depends on:
Blocks: gcc-11
  Show dependency tree
Reported: 2021-04-28 07:14 UTC by Toralf Förster
Modified: 2021-06-13 19:06 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---

emerge-info.txt (emerge-info.txt,17.15 KB, text/plain)
2021-04-28 07:14 UTC, Toralf Förster
emerge-history.txt (emerge-history.txt,170.37 KB, text/plain)
2021-04-28 07:15 UTC, Toralf Förster
environment (environment,95.33 KB, text/plain)
2021-04-28 07:15 UTC, Toralf Förster
etc.portage.tar.bz2 (etc.portage.tar.bz2,11.96 KB, application/x-bzip)
2021-04-28 07:15 UTC, Toralf Förster
games-fps:darkplaces-20140513-r1:20210428-055408.log (games-fps:darkplaces-20140513-r1:20210428-055408.log,19.58 KB, text/plain)
2021-04-28 07:15 UTC, Toralf Förster
temp.tar.bz2 (temp.tar.bz2,24.85 KB, application/x-bzip)
2021-04-28 07:15 UTC, Toralf Förster
darkplaces-20140513-align-structs-not-typedefs.patch (darkplaces-20140513-align-structs-not-typedefs.patch,2.87 KB, patch)
2021-04-30 04:54 UTC, Matt Whitlock
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2021-04-28 07:14:58 UTC
x86_64-pc-linux-gnu-gcc -MMD  -DDP_FS_BASEDIR=\""/usr/share/quake1"\" -Wall -Wold-style-definition -Wstrict-prototypes -Wsign-compare -Wdeclaration-after-statement -Wmissing-prototypes -DLINK_TO_ZLIB -DLINK_TO_LIBJPEG  -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES -I../../../ -DCONFIG_MENU -DCONFIG_CD -DCONFIG_VIDEO_CAPTURE   -pipe -march=native -Og -g -c ../../../dpsoftrast.c -o dpsoftrast.o -msse2
../../../dpsoftrast.c:239:22: error: size of array element is not a multiple of its alignment
  239 | typedef ALIGN(struct DPSOFTRAST_State_Thread_s
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~
../../../dpsoftrast.c:45:36: note: in definition of macro ‘ALIGN’
   45 |                 #define ALIGN(var) var __attribute__((__aligned__(16)))


  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 17.1_desktop_gnome_systemd-20210424-085324


gcc-config -l:
 [1] x86_64-pc-linux-gnu-10.3.0
 [2] x86_64-pc-linux-gnu-11.1.0 *
clang version 12.0.0
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/12/bin
Python 3.8.9
Available Ruby profiles:
  [1]   ruby26 (with Rubygems)
  [2]   ruby30 (with Rubygems) *
Available Rust versions:
  [1]   rust-bin-1.51.0 *
The following VMs are available for generation-2:
*)	AdoptOpenJDK 8.292_p10 [openjdk-bin-8]
Available Java Virtual Machines:
  [1]   openjdk-bin-8  system-vm

The Glorious Glasgow Haskell Compilation System, version 8.10.4

  timestamp(s) of HEAD at this tinderbox image:
/var/db/repos/gentoo	Wed Apr 28 05:05:32 UTC 2021

emerge -qpvO games-fps/darkplaces
[ebuild  N    ] games-fps/darkplaces-20140513-r1  USE="alsa opengl sdl -cdinstall -cdsound -debug -dedicated -demo -lights -oss -textures"
Comment 1 Toralf Förster gentoo-dev 2021-04-28 07:14:59 UTC
Created attachment 703059 [details]
Comment 2 Toralf Förster gentoo-dev 2021-04-28 07:15:00 UTC
Created attachment 703062 [details]
Comment 3 Toralf Förster gentoo-dev 2021-04-28 07:15:02 UTC
Created attachment 703065 [details]
Comment 4 Toralf Förster gentoo-dev 2021-04-28 07:15:03 UTC
Created attachment 703068 [details]
Comment 5 Toralf Förster gentoo-dev 2021-04-28 07:15:04 UTC
Created attachment 703071 [details]
Comment 6 Toralf Förster gentoo-dev 2021-04-28 07:15:06 UTC
Created attachment 703074 [details]
Comment 7 Matt Whitlock 2021-04-30 04:54:27 UTC
Created attachment 704133 [details, diff]

The problem arises because dpsoftrast.c declares overaligned types whose sizes are not multiples of their alignment. The apparent intent was to specify the alignment of the structures, which would add internal padding as necessary to increase the sizes of the structures to a multiple of their alignment, but the attribute was improperly positioned such that it applied to the typedefs rather than to the structure definitions.

The attached patch correctly positions the __attribute__((__aligned__(16))) *after* the struct keyword so that the attribute applies to the structure definitions rather than to the type definitions.

For more commentary, see:
Comment 8 jospezial 2021-05-01 03:18:19 UTC
games-fps/xonotic-0.8.2 ebuild has this engine bundled and fails with gcc11 on the same file with the same error.
Comment 9 Larry the Git Cow gentoo-dev 2021-06-13 18:52:03 UTC
The bug has been closed via the following commit(s):

commit bc2ba1cd6fdc5a7ad7d161efb21652b73c6b207e
Author:     Sergei Trofimovich <>
AuthorDate: 2021-06-13 18:51:51 +0000
Commit:     Sergei Trofimovich <>
CommitDate: 2021-06-13 18:51:58 +0000

    games-fps/darkplaces: tweak for gcc-11
    Reported-by: Toralf Förster
    Package-Manager: Portage-3.0.19, Repoman-3.0.3
    Signed-off-by: Sergei Trofimovich <>

 games-fps/darkplaces/darkplaces-20140513-r1.ebuild |  2 +
 .../files/darkplaces-20140513-gcc-11.patch         | 43 ++++++++++++++++++++++
 2 files changed, 45 insertions(+)
Comment 10 Matt Whitlock 2021-06-13 19:06:08 UTC
Note that the committed patch implements the fix in a "less preferred" style than the patch I proposed.

Per the GCC documentation <>:

> You may specify type attributes in an enum, struct or union type declaration or definition by placing them immediately after the struct, union or enum keyword. You can also place them just past the closing curly brace of the definition, but this is less preferred because logically the type should be fully defined at the closing brace.