[an error occurred while processing this directive]

HP OpenVMS Systems

Ask the Wizard
» 

HP OpenVMS Systems

OpenVMS information

» What's new on our site
» Upcoming events
» Configuration and buying assistance
» Send us your comments

HP OpenVMS systems

» OpenVMS software
» Supported Servers
» OpenVMS virtualization
» OpenVMS solutions and partners
» OpenVMS success stories
» OpenVMS service and support
» OpenVMS resources and information
» OpenVMS documentation
» Education and training

Quick Links

» Non-javascript page
» Ask the Wizard
» OpenVMS FAQ

Test Drive OpenVMS

» OpenVMS I64 test drive
» Java test drive

Other information resources available to you include:

» OpenVMS freeware
» ECO kits, software and hardware support, prior version support
» Alpha SRM, ARC, and AlphaBIOS firmware updates
» ENCOMPASS - HP user group
» OpenVMS software downloads, OpenVMS freeware CD-ROM
» OpenVMS firmware locations
» DECconnect passive adaptor charts
» Cables reference guide
» MicroVAX console commands
» OpenVMS student research

Select a topic below to see Questions Frequently Asked by partners

» Using the online documentation library(installing BNU from the asap SDK)
» Global sections(how to create and use.)
» xx$CREATE_BUFOBJ system service(usage)
» Ethernet address(methods of determination)
» Shareable images(cookbook approach to creating one)
» Sharing data/code at absolute addresses(a guide with examples)
» Determining the Alpha microprocessor
» Using GETSYI to get hardware status

Evolving business value

» Business Systems Evolution
» AlphaServer systems transition planning
» Alpha RetainTrust program

Related links

» HP Integrity servers
» HP Alpha systems
» HP storage
» HP software
» HP products and services
» HP solutions
» HP support
disaster proof
HP Integrity server animation
HP Integrity server animation
Content starts here

Ask the Wizard Questions

Restricted pointers in DEC C

The Question is:

Dear Wizard:

This is a really C question, but as it concerns a #pragma (or rather
the lack of one) it is specific to DEC C.

Consider the following function definition

    void f(float * a, const float * const b)
    {
        *++a = *b;
        *++a = *b;
    }

for which DEC C V5.0-003 (with /OPTIMIZE=LEVEL=4) produces the
following code:

        ADDL    a, 4, a
        LDF     F0, (R17)
        STF     F0, (R16)
        ADDL    a, 4, R16
        LDF     F1, (R17)
        STF     F1, (R16)
        RET     R26

Observe that *b is loaded twice, as it must be because according the C
semantics b and a could point to the same location. There is
apparently no way to tell DEC C that a and b will always point at
disjoint regions of memory; it is not expressible within the language
itself, although some compilers provide a #pragma to do so.

It is of course very easy to rewrite the trivial example above to
avoid the problem, but there are many more interesting examples where
it seems harder to find such a solution. For instance, consider matrix
multiplication where I would like to tell the compiler that the result
matrix is disjoint from the argument matrices. At present the
generated code contains lots of unnecessary loads which reduces the
performance considerably, which is especially galling as the result
obtained using the obvious algorithm (without a matrix temporary) is
wrong if the result and arguments are not disjoint anyhow!

I could copy the arguments into local temporaries, but then I run into
a whole lot of problems, such as that I might inhibit optimizations
like loop unrolling and instruction scheduling, and that I need to
allocate the memory for the temporaries somewhere (which is not so
easy if the number of temporaries is not known at compile time).

I welcome your suggestions, as I find that this problem makes it hard
approach the peak floating point performance of an Alpha processor
using DEC C.


The Answer is:

What you are asking for is a feature known as "restricted pointers".  We have
no firm plans to implement this, but it is on our wishlist.  Thanks for your
interest in DEC C.