D Front End for GCC - Release 0.24

Last update: August 22, 2007

Supported Systems

Similar versions of the above systems should work and other Unix platforms may work.  Although the compiler will probably work on most architectures, the D runtime library will still need to be updated to support them.


The MacOS X universal binary package requires XCode 2.4.1 or the equivalent version of cctools.




David Friedman
e-mail: dvdfrdmn <at> users.sf.net


Known Issues

Known Differences from DMD

Inline Assembler Notes


Invoking gdc and gdmd

The compiler driver is named 'gdc' and accepts the standard GCC options.  There is also a script named 'gdmd' which has the same interface as the Digital Mars dmd.

The mapping from DMD options to GCC is as follows:
-d -fdeprecated
-I <path>
-O3 without inlining (may not be equivalent)
no equivalent; use the wrapper script
-of<file> -o <file>
no equivalent; use the wrapper script
(see the GCC manual for profiling options)
no equivalent
no equivalent; use the wrapper script
<.ddoc file>
-fdoc-inc=<.ddoc file>

Other options:
Controls array bounds checking
Controls whether or not template code is emitted.

"normal" -- Emit templates, expecting multiple copies to be merged by the linker.
"private" -- Emit templates, but make them private to the translation unit.  The executable will have multiple copies of code and data.
"all" -- Emit all template instances with public visibility.  Do this even if they would not normally be emitted.
"none" -- Do not emit templates at all.
"auto" -- For targets that support templates, the "full" mode is used.  Otherwise, the "private" mode is used.

"none" and -fno-emit-templates are synonyms.
"auto" and -femit-templates are synonyms.
For each source file on the command line, semantically process each file preceding it.  Use this if compilation errors occur due to complicated circular module references.  This will slow compilation noticeably.
Dump decoded UTF-8 text and source from HTML to <source>.utf-8 and <source>.d.utf-8.


Extended Assembler
GDC implements a GCC extension that allows inline assembler with D expression operands.  It is available on nearly all targets, not just i386.  The syntax differs from the C language extension in the follow ways. Unlike i386 inline assembler statements, extended assembler statements do not prevent a function from being inlined.

See the GCC manual for more information about this extension.


uint invert(uint v)
    uint result;
       asm{ "notl %[iov]" : [iov] "=r" result : "0" v; }
    else version(PPC)
       asm{ "nor %[oresult],%[iv],%[iv]" : [oresult] "=r" result : [iv] "r" v; }
    return result;
Declaration and Type Attributes
(This extension is a work in progress.)

GDC implements the GCC __attribute__ extension with two pragmas:

pragma(GNU_attribute, name1(arg1, arg2, ...), ...) declarations...

pragma(GNU_set_attribute, symbol, name1(arg1, arg2...), ...);

If an attribute has no arguments, the argument list may be omitted.

The first form applies to declarations directly contained in the pragma.  The second form affects the given symbol.  See the GCC manual for a list of attributes that can be set.  Not all attributes are supported yet by GDC.  Also, the interaction between these extended attributes and D languge attributes (alignment, for example) is not well defined.


0.24: 0.23: 0.22: 0.21: 0.20: 0.19: 0.18:

    Updated to DMD 0.128




    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA