HP Integrity Servers HP aC++/HP ANSI C Release Notes Version A.06.
© Copyright 2010 Hewlett-Packard Development Company L.P. All rights reserved Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license. The information contained herein is subject to change without notice.
Table of Contents 1 HP aC++/HP ANSI C Release Notes...........................................................................................7 2 What’s New in This Version........................................................................................................9 New Features in Version A.06.25.........................................................................................9 C99 default C compilation mode (Changed)................................................................
+check=lock (New)........................................................................................................25 +check=thread (New).....................................................................................................25 +O[no]autopar now supported in C++ Mode (New)....................................................25 +O[no]dynopt (HP-UX 11.31 only) (New)....................................................................26 +inline_level num (Enhanced).............................
+FPmode Option (Enhanced)........................................................................................38 +Ointeger_overflow (Default Changed)........................................................................38 +Onolibcalls= Option (New)..........................................................................................38 +wendian Option (New)................................................................................................38 +wlint Option (Enhanced)......................
HP C World Wide Web Homepage...............................................................................
1 HP aC++/HP ANSI C Release Notes The information in this document applies to the release of HP aC++ and HP ANSI C compilers version A.06.25 for the HP-UX 11i v2 and v3 operating system on Integrity servers. The HP ANSI C compiler supports ANSI programming language C standard ISO 9899:1999. HP aC++ compiler supports the ISO/IEC 14882 Standard for the C++ Programming Language (the international standard for C++). HP ANSI C and HP aC++ are distributed as a single software bundle.
2 What’s New in This Version This chapter gives an overview of the new command-line options and features introduced in this version of the HP aC++/HP C compiler. Version A.06.25 of the HP aC++/HP C compiler provides leading edge support for C++0x standard language features, with complete binary compatibility with earlier releases and -AA compilation mode. New Features in Version A.06.25 Version A.06.
• • • Improved diagnostic messages (Changed) Enhanced +wendian warnings (New/Changed) New run-time abort messages (New) C99 default C compilation mode (Changed) In this version of the HP C/aC++ compiler, the default C compilation mode has changed from C89 to C99. So by default C99 features are enabled, and the following commands are now equivalent: cc cc -Ae cc -AC99 aCC -Ae aCC -AC99 To retain the previous behavior, use the -AC89 command-line option.
warning #2780-D: reference is to variable "i" (declared at line X) [Under old for-init scoping rules it would have been variable "i" (declared at line Y)] With +wlint: warning #3348-D: declaration hides variable "i" (declared at line X) To catch issues resulting from this change in the C++ default, compile with the +We2780 option to convert the warning 2780 to an error. If you are already using the -Aa or -AA command-line option explicitly, then there would be no change in behavior.
template struct S { static_assert(sizeof(T) > 4, "Type too small"); }; S s1; // Will trigger an error when the static_assert // declaration is instantiated. Extended friend types Support is now included for extended friend declaration syntax which allows for non-class names and non-elaborated class names to be declared as friend.
C++0x relaxes that restriction to allow such names as an unevaluated operand, such as sizeof(X::m), typeid(X::m), and decltype(X::m). With this release, aC++ now accepts this usage in C++0x mode and non-strict C++98/03 mode; such references are transformed into a compiler-generated member-access expression using 0 cast to the appropriate type as the object pointer.
a lambda function typically encloses the runtime state or environment of the declaring function, being therefore able to access the local variables of the current function. The way these variables are accessed can be controlled using either the '&' in a lambda capture list ([&]), in which case the variables are passed by reference; by using a '=' ([=]), whereby the variables are simply copied (analogous to call-by-value); or a combination of the two.
# define PRINTF(...) printf (__VA_ARGS__) int main() { char* from = "aCC"; PRINTF("Hello, World" " from %s!\n", from); return 0; } // This will print: // Hello, World from aCC! _Pragma operator The _Pragma operator (originally from C99 and already supported in GNU mode), is now supported in non-strict C++98/C++03 mode and in all C++0x modes. The operator has the effect of expanding the pragma specified in the string (in double-quotes) in just the way a #pragma would.
For more information on using Decimal FP, see the release notes section "Decimal floating-point arithmetic supported" under "New Features in the A.06.20 Release." #pragma STDC FLOAT_CONST_DECIMAL64 (New) #pragma STDC FLOAT_CONST_DECIMAL64 [ON | OFF | DEFAULT] With this pragma set to OFF, unsuffixed floating-point constants are treated as having type double. With this pragma set to ON, unsuffixed floating-point constants are treated as having type _Decimal64.
firstprivate (list) shared (list) #pragma omp taskwait (New) #pragma omp taskwait new-line The OpenMP 3.0 directive #pragma omp taskwait specifies a wait on the completion of child tasks generated since the beginning of the current task. Because the taskwait construct does not have a C language statement as part of its syntax, there are some restrictions on its placement within a program. The taskwait directive may be placed only at a point where a base language statement is allowed.
New diagnostic messages (New) The following new diagnostic messages are added to the compiler: • Warning #3750 Warning #3750 is now emitted for lines that end with a backslash followed by a space. For example: int main(){ int something; \ int anotherthing; } line 2: warning #3750-D: "\" followed by white space is not a line splice • Warning #2767 In 64-bit C compilations, casting a pointer to an integral type of lower size now generates warning #2767. Previously, this was only a remark.
Enhanced +wendian warnings (New/Changed) When using the same code on platforms with different endian behavior, the results of many operations will vary between the two. Using the +wendian option with aCC will produce warnings for such statements that give differing results in different endian systems.
• • • • • #pragma diag_push (New) #pragma diag_pop (New) +Oinlinebudget is deprecated In next release, default C compilation mode will change from C89 to C99 In next release, default C++ compilation mode changes to full -AA Decimal floating-point arithmetic (HP-UX 11.31 only) (New) On HP-UX 11.31 systems, support is now included for decimal floating-point arithmetic for C.
compiler uses, and the "decimal encoding". Both encodings provide exactly the same data, analogous to big endian and little endian encodings. • • • • • • • • • Decimal FP I/O and string conversion. The decimal FP length modifiers for printf() and scanf() floating-point conversion specifiers (a, A, e, E, f, F, g, G) are H for _Decimal32, D for _Decimal64, and DD for _Decimal128.
• • To use strtod32, strtod64, or strtod128, include . (These interfaces are not declared in , as specified in the ISO/IEC C draft Technical Report.) Also see the “HP-UX floating-point guide for HP Integrity servers” at http:// www.hp.com/go/fp. Decimal Floating-Point Example /*********************************************************************** * * This program is intended to illustrate how C decimal FP might be * used in a commercial billing program.
int r, s; _Binaryencoding64 be; _Decimalencoding64 de; // fread, scanf returns // for binary-encoded (bid) input // for decimal-encoded (dpd) input // open input file if (encoding == ascii) inp = fopen(ifilename, "r"); else inp = fopen(ifilename, "rb"); if (inp == NULL) { fprintf(stderr, "FAILURE: could not open %s\n", ifilename); exit(EXIT_FAILURE); } // open output file outp = fopen(ofilename, "w"); if (outp == NULL) { fprintf(stderr, "FAILURE: could not open %s\n", ofilename); exit(EXIT_FAILURE); } //
b = rate * h; b = quantized64(b, twort); // round to hundredths // restore decimal rounding mode to default fe_dec_setround(FE_DEC_TONEAREST); // print billing amount to file fprintf(outp, "%Da\n", b); // update sums sumM += m; sumH += h; sumB += b; } // main loop // close files fclose(inp); fclose(outp); // confirm expected quantum in sums assert(samequantumd64(sumH, onert)); assert(samequantumd64(sumB, twort)); // print summary printf("SUMMARY:\n"); printf(" number of calls printf(" total minutes printf("
+annotate=structs (New) The +annotate=structs option annotates the compiled binary with accesses to C/C++ struct fields for use by other external tools such as Caliper. By default, no annotations are added. +check=lock (New) The new runtime +check=lock option enables the checking of locking discipline violations; for example, whether appropriate locks are held when threads access shared data in applications using Posix threads. Refer to the online programmer's guide for additional detail and code example.
+O[no]dynopt (HP-UX 11.31 only) (New) On HP-UX 11.31 systems, the +O[no]dynopt option enables [disables] dynamic optimization for the output file. Both forms of this option change the default setting, which allows the run-time environment to enable or disable dynamic optimization according to a system-wide default. This option applies only to executable files and shared libraries, if the run-time environment supports this feature.
#pragma diag_pop (New) This pragma restores the severities of all diagnostics to the state prior to the last #pragma diag_push. A compilation unit should have an equal number of #pragma diag_push and #pragma diag_pop uses. +Oinlinebudget is deprecated (Change) The +Oinlinebudget option is deprecated in this release and will not be supported in future releases. Use +inline_level.
error #2020: identifier "i" is undefined • Reference to outer scope variable instead of loop index: warning #2780-D: reference is to variable "i" (declared at line X) -under old for-init scoping rules it would have been variable "i" (declared at line Y) With +wlint: warning #3348-D: declaration hides variable "i" (declared at line X) By also compiling with +We2780, the two errors, 2020 and 2780, should catch any issues resulting from the change in the C++ default.
printf, fprintf Optimization (New) For optimization level+O2or above, printf and fprintf calls are now optimized into fputc or fputs calls, in trivial cases. This optimization will only occur when both the following are true • • A return value is not used for printf and fprintf. For example, use (void)fprintf(...); The functions printf, fprintf, fputs, and fputc are declared in or . To disable this feature for +O2and above, use: +Onolibcalls="fprintf" (or "printf").
+Wv Option (New) +Wv[d1,d2,...,dn] The new +Wvoption displays the description for diagnostic message numbers d1,d2,...,dn. Specifying this option causes HP Code Advisor to emit the descriptive text for the specified diagnostics to stderr. This option must not be used with any other compiler options. If the description for a diagnostic is not available, HP Code Advisor emits only the diagnostic with a note that the description is not available.
directives. For these loops, the compiler automatically parallelizes each loop that is both safe and likely to have improved performance when executed in parallel. Programs compiled with the +Oautopar option require the libcps, libomp, and libpthreads runtime support libraries to be present at both compilation and runtime. When linking with the HP-UX B.11.61 linker (patch PHSS_36342 or PHSS_36349), compiling with the +Oautoparoption causes them to be automatically included.
Using an array will force the string to be read/write.
global_fixed_size Generates a fixed-size (65536 items) global path table and records basic block-execution information in it at runtime. This form differs from+pathtrace=global because the size of the table cannot be configured at runtime, and the contents cannot be dumped to a file. The fixed-size global path table has better runtime performance than the configurable global path table. The performance difference varies depending on the optimization level and how the program is written.
The +check=globals option is implied by +check=all. • +check=truncate[:explicit|:implicit] The +check=truncate option enables runtime checks to detect data loss in assignment when integral values are truncated. Data loss occurs if the truncated bits are not all the same as the left most non-truncated bit for signed type, or not all zero for unsigned type. Programs may contain intentional truncation at runtime, such as when obtaining a hash value from a pointer or integer.
-Bhidden_def (New) -Bhidden_def This option is the same as -Bhidden, but only locally defined (non-tentative) symbols, without __declspec(dllexport), are assigned the hidden export class. As with any -B option, -Bhidden_def can be overridden by subsequent -B options on the command line or any binding pragmas in the source. -dM (New) -dM The -dM option requires that-P or -E also be specified.
For more information, see the "Inline assembly for Itanium(R)-based HP-UX" link off http://www.hp.com/go/cpp. Debugging Code Compiled with Opt Levels above +O1 Is Supported Debugging code compiled with optimization levels above +O1is now supported, as described in section 14.22 ("Debugging optimized code") of the Debugging with GDB manual under the "Documentation" link at: http://www.hp.com/go/wdb.
+Ofast (-fast) and +Ofaster Options The +Ofast and +Ofaster options now cause the data and text page size to be 1MB instead of 4MB, for increased performance The +Ofast option no longer implies the unsafe optimizations +Ointeger_overflow=aggressive and +Olibcalls.
Use "/opt/cadvise/bin/cadvise" to invoke the tool. A brief description is available with the -help option. $ /opt/cadvise/bin/cadvise -help Additional information is available at: http://www.hp.com/go/cadvise +cond_rodata Option (Obsoleted) The compiler now allocates more data in read-only memory. This option is now obsolete. The compiler always behaves as if it had been specified. (Note: a previous posting of these notes contained a typographic error. +cond_rodata was mispelled.
+wlint Option (Enhanced) New diagnostic features have been added for this option. New checks have been added for memory leaks, out-of-scope memory access, null pointer dereference, and out-of-bounds access. +wsecurity= Option (Enhanced) The +wsecurity option now optionally takes a argument to control how verbosely the security messages are emitted: +wsecurity=[1|2|3|4] The default level is 2. System-wide Option Configuration There is a new ability to configure compiler options on a system-wide basis.
-AA -D_HP_NONSTD_FAST_IOSTREAM Performance Improvement Macro A new performance improvement preprocessor macro, _HP_NONSTD_FAST_IOSTREAM can be used to improve -AA iostream performance. This macro enables the following non-standard features: • • • Sets std::ios_base::sync_with_stdio(false), which disables the default synchronization with stdio. Sets std::cin.tie(0), which unties the cin from other streams. Replaces all occurrences of "std::endl" with "\n".
Earlier Versions Information on features introduced in versions before A.06.12 can be found in Release Notes for each compiler version located at the HP documentation website: www.docs.hp.
3 Installation Information Read this entire document and any other release notes or readme files you may have before you begin an installation. To install your software, run the SD-UX swinstall command. This invokes a user interface that will lead you through the installation. For more information about installation procedures and related issues, refer to Managing HP-UX Software with SD-UX and other README, installation, and upgrade documentation provided or described in your HP-UX 11.
4 Compatibility Information Maintaining binary compatibility is a key release requirement for new versions of HP aC++. The compiler has maintained the same object model and calling convention and remains compatible with the HP-UX runtime in the code that it generates as well as its intrinsic runtime library (libCsup) across the various releases of HP aC++ and its run-time patch stream.
int main() { printf("%d\n",sizeof(A)); } Migrating From HP C++ (cfront) to HP aC++ The compiler lists Errors, Future Errors, and Warnings. Expect to see more warnings, errors and future errors reported in your code, many related to standards based syntax. For more complete information, refer to the HP aC++ Transition Guide at: http:// www.hp.
5 Known Problems and Workarounds This section describes known problems and workarounds. Customers on support can use the product number to assist them in finding SSB and SRB reports for HP aC++ or HPC. The product number you can search for is B3910BA. To verify the product number and version for your HP aC++ or HP C compiler, execute the following HP-UX commands: what /opt/aCC/bin/aCC what /opt/aCC/lbin/ecom Obsolete LANG-STARTUP Files As of HP aC++ version A.06.
Definition: foo.c:uint64_t variable[SIZE]; Reference: bar.c:extern uint64_t variable; ld: The value 0xXXX does not fit when applying the relocation GPREL22 for symbol "variable" at offset 0xYYY in section index ZZZ of file bar.o. Workaround: The declaration should be changed to: extern uint64_t variable[]; This error can also occur in assembly code if items <= 8 bytes are put into.data/.bss instead of .sdata/.sbss.
#include // multiplies can be used in int main() {} // end of test.c The following flags are now automatically set with A.05.* and A.06.* compilers: • • • • • • • -D__HPACC_USING_MULTIPLIES_IN_FUNCTIONAL -D__HPACC_THREAD_SAFE_RB_TREE -D__HPACC_USING_MULTIPLIES_IN_FUNCTIONAL -D__HPACC-FIX_FUNC_ADAPTER_OPERATOR -D__HPACC_FULL_ITERATOR_REL_OPS -D__HPACC_TEMPLATE_PAIR_CTOR -D__HPACC_MEM_FUN_ADAPTOR Conflict Between macros.
• file which defines a dummy function that has a parameter of that type (Widget) and link it into the executable program. Known limitations of exception handling features: — Interoperability with setjmp/longjmp (undefined by the ISO/ANSI C++ international standard) is unimplemented. Executing longjmp does not cause any destructors to be run.
This will insure that, when the application is migrated to a system that has a later version of libA available, the actual version desired is the one that is dynamically loaded. • Memory Allocation Routine alloca() The compiler supports the built in function, alloca, defined in the /usr/include/alloca.h header file. The implementation of the alloca() routine is system dependent, and its use is not encouraged. alloca() is a memory allocation routine similar to malloc() (see malloc(3C)).
6 Related Documentation Documentation for HP aC++ / HP C is described in the following sections. Online Documentation The following online documentation is included with the HP aC++/HP C products: • HP aC++ Programmer’s Guide Access this guide in any of the following ways: — Use the +help command-line option: /opt/aCC/bin/aCC +help — From your web browser, enter the appropriate URL: file:/opt/aCC/html/C/guide/index.
• Rogue Wave Software Standard C++ Library 2.2.1 User’s Guide This guide gives information about library usage and includes an extensive discussion of locales and iostreams. The guide is provided as HTML formatted files. You can view these files with an HTML browser by opening the file /opt/aCC/html/libstd_v2/stdug/ index.htm or select the hyperlink in the main online help topic for HP aC++. • Rogue Wave Software Standard C++ Library 1.2.
Online C++ Example Source Files Online C++ example source files are located in the /opt/aCC/contrib/Examples/ RogueWave directory. These include examples for the Standard C++ Library and for the Tools.h++ Library. Printed Documentation HP aC++/HP C Release Notes is this document. A printed copy of the release notes is provided with the HP aC++ / HP C product. Release notes are also provided online, as noted above.
*B3901-90032* Printed in the US