GNU Fortran Compiler Options Quiz
53 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What does the -Wintrinsic-shadow option do?

  • Warns if a procedure has the same name as an intrinsic. (correct)
  • Provides hints for optimizing intrinsic procedures.
  • Automatically renames user-defined procedures.
  • Suppresses warnings about intrinsic procedures.
  • What are the implications of using the -Wunused-parameter option in gfortran?

  • It is included in the -Wall option.
  • It ignores all parameter warnings.
  • It warns about unused PARAMETER values. (correct)
  • It warns about unused dummy arguments.
  • What does the -Werror option accomplish?

  • It turns all warnings into errors. (correct)
  • It suppresses all warnings during compilation.
  • It converts errors into warnings.
  • It treats all warnings as non-critical.
  • What is the primary use of the -fdump-parse-tree option?

    <p>To debug the internal working of the gfortran compiler. (D)</p> Signup and view all the answers

    Which IEEE exceptions can be specified with the -ffpe-trap option?

    <p>Invalid, zero, overflow, underflow, precision, and denormal. (C)</p> Signup and view all the answers

    What happens when the -Walign-commons option is activated?

    <p>It warns about variable padding for alignment in COMMON blocks. (C)</p> Signup and view all the answers

    Which option is used to suppress the warnings generated by -Walign-commons?

    <p>-Wno-align-commons (B)</p> Signup and view all the answers

    What does the parameter 'list' in the -ffpe-trap option represent?

    <p>A list of specific IEEE exceptions to raise for FPE. (A)</p> Signup and view all the answers

    Which version of the Fortran standard is NOT fully supported by the GNU Fortran compiler?

    <p>Fortran 2008 (A)</p> Signup and view all the answers

    What is the primary purpose of the gfortran command?

    <p>To invoke the GNU Fortran compiler (D)</p> Signup and view all the answers

    What happens after the compilation of a Fortran program using gfortran?

    <p>The source code is translated into machine code (D)</p> Signup and view all the answers

    Which of the following best describes the errors the Fortran 90 standard requires the compiler to report?

    <p>Flaws in source code that prevent binary creation (D)</p> Signup and view all the answers

    What is a key benefit of using high-level programming languages like Fortran over machine code?

    <p>They are faster to write (A)</p> Signup and view all the answers

    Which of the following statements is true regarding the GNU Fortran compiler's support for language standards?

    <p>It completely supports Fortran 77, 90, and 95 standards. (D)</p> Signup and view all the answers

    In what case will the GNU Fortran compiler provide error messages to users?

    <p>When the source code is flawed (C)</p> Signup and view all the answers

    Which of the following is NOT a goal of the GNU Fortran compiler?

    <p>Providing a debugging environment for users (C)</p> Signup and view all the answers

    What does the option '-fopenmp' enable in a Fortran program?

    <p>OpenMP directives and runtime library linking (A)</p> Signup and view all the answers

    What is the consequence of using '-fno-range-check' in a Fortran compilation?

    <p>Expressions outside the range will be assigned +Inf or -Inf (D)</p> Signup and view all the answers

    Which of the following standards does the option '-std=legacy' refer to?

    <p>Old non-standard programs without warnings (A)</p> Signup and view all the answers

    Which option specifies that preprocessing should be enabled in Fortran?

    <p>-cpp (B)</p> Signup and view all the answers

    What is the default standard value for Fortran when no standard is specified?

    <p>gnu (A)</p> Signup and view all the answers

    What does the option '-std=f2003' enforce during compilation?

    <p>Strict conformance to Fortran 2003 standards (C)</p> Signup and view all the answers

    What will occur if an integer overflow is detected with '-fno-range-check' option?

    <p>The value will wrap around to -1 (B)</p> Signup and view all the answers

    When enabling OpenMP with '-fopenmp', which feature is also implicitly enabled?

    <p>Recursive function support (C)</p> Signup and view all the answers

    What is the impact of using the option '-fmax-stack-var-size=n'?

    <p>It affects the size of the largest array placed on the stack. (C)</p> Signup and view all the answers

    Which option should be used to allow recursive procedures without the RECURSIVE attribute?

    <p>-frecursive (D)</p> Signup and view all the answers

    What does the '-fpack-derived' option do?

    <p>It packs derived type members closely together. (D)</p> Signup and view all the answers

    How does the '-frepack-arrays' option affect array handling?

    <p>It ensures data is passed contiguously for better performance. (C)</p> Signup and view all the answers

    What is the consequence of using the '-fshort-enums' option?

    <p>It allows all enumerators to fit into the smallest INTEGER kind. (C)</p> Signup and view all the answers

    What is a potential downside of using the '-fpack-derived' option?

    <p>It could lead to incompatibilities with other compiled code. (C)</p> Signup and view all the answers

    What is the default value for the '-fmax-stack-var-size' option?

    <p>32768 (C)</p> Signup and view all the answers

    What happens when the size of an array exceeds the limit set by '-fmax-stack-var-size'?

    <p>Static memory will be used instead of stack memory. (B)</p> Signup and view all the answers

    What type of function is BESSEL_J1?

    <p>Bessel function of the first kind of order 1 (A)</p> Signup and view all the answers

    Which function is used to test for NaN (Not a Number) values?

    <p>ISNAN (B)</p> Signup and view all the answers

    The CEILING function is used to:

    <p>Round up to the nearest integer (C)</p> Signup and view all the answers

    Which intrinsic function would you use to get the current time as a string?

    <p>CTIME (B)</p> Signup and view all the answers

    Which function provides the bit size inquiry for a variable?

    <p>BIT_SIZE (A)</p> Signup and view all the answers

    What does the MOD function do?

    <p>Returns the remainder of a division (B)</p> Signup and view all the answers

    To convert a double precision real number to a default real number, which function would you use?

    <p>SNGL (D)</p> Signup and view all the answers

    Which function would you use to remove trailing blank characters from a string?

    <p>TRIM (D)</p> Signup and view all the answers

    What is the purpose of the EXIT function?

    <p>To terminate a program or process (B)</p> Signup and view all the answers

    Which function calculates the Euclidean distance between two points?

    <p>HYPOT (D)</p> Signup and view all the answers

    Which function can be used to initialize a pseudo-random number sequence?

    <p>RANDOM_SEED (D)</p> Signup and view all the answers

    What does the LEN_TRIM function return?

    <p>The length excluding trailing blanks (B)</p> Signup and view all the answers

    Which of the following functions converts an integer to a default real type?

    <p>FLOAT (B)</p> Signup and view all the answers

    Which of the following file extensions will GNU Fortran recognize for compiling Fortran source code?

    <p>.f90 (B)</p> Signup and view all the answers

    What is the purpose of the GCC middle end in the compilation process?

    <p>Optimizes code (C)</p> Signup and view all the answers

    What is the role of the 'gfortran' driver program within the GCC?

    <p>It automatically links Fortran runtime libraries (A)</p> Signup and view all the answers

    Which statement about preprocessing and conditional compilation in GNU Fortran is correct?

    <p>The GNU C Preprocessor is commonly used for preprocessing. (B)</p> Signup and view all the answers

    How does GCC determine whether to treat a source file as fixed form or free form?

    <p>By the file extension (B)</p> Signup and view all the answers

    What is the primary document that provides a complete reference for the GNU Fortran compiler?

    <p>GNU Fortran and GCC Manual (D)</p> Signup and view all the answers

    Which command does the gcc driver program primarily use to compile Fortran source files?

    <p>f951 (A)</p> Signup and view all the answers

    What characteristic do the capitalized file extensions have when processed by the GNU Fortran compiler?

    <p>They undergo preprocessing. (D)</p> Signup and view all the answers

    Flashcards

    '-fopenmp' option

    Enables OpenMP extensions, allowing for parallel processing using !$omp directives. It also links the OpenMP runtime library for execution.

    '-fno-range-check' option

    Disables range checking for simplified constant expressions during compilation. For example, it allows division by zero without raising an error.

    '-std=std' option

    Specifies the Fortran standard for the program. Options include 'f95', 'f2003', 'f2008', 'gnu', and 'legacy'.

    '-cpp' option

    Enables the preprocessor, a tool that transforms source code before compilation. Automatically invoked for files with extensions like '.fpp', '.FPP', '.F', '.FOR', etc.

    Signup and view all the flashcards

    '-nocpp' option

    Disables preprocessing, preventing the preprocessor from modifying the source code before compilation.

    Signup and view all the flashcards

    gfortran

    A free replacement for the unix f95 command.

    Signup and view all the flashcards

    GNU Fortran compiler features

    The GNU Fortran compiler supports the Fortran 77, 90 and 95 standards completely, parts of the Fortran 2003 and Fortran 2008 standards, and several vendor extensions.

    Signup and view all the flashcards

    Compilation

    The process of translating the user's program into instructions a computer can carry out more quickly.

    Signup and view all the flashcards

    Machine code

    The result after compiling a program, code designed to be efficiently translated and processed by a machine.

    Signup and view all the flashcards

    Errors in source code

    Mistakes made in the source code that prevent compilation.

    Signup and view all the flashcards

    Error messages

    Messages provided by the compiler that point out mistakes in the source code.

    Signup and view all the flashcards

    Compiler diagnostics

    The compiler's ability to generate information about why it's unable to compile the source code.

    Signup and view all the flashcards

    Translation of source code to machine code

    The process of converting source code, which is written in a human-readable language, into machine code, which is understood by a computer.

    Signup and view all the flashcards

    '-fdump-parse-tree'

    A debugging option for GNU Fortran that outputs the program's syntax tree before generating code. It's primarily useful for debugging the compiler itself.

    Signup and view all the flashcards

    '-ffpe-trap=list'

    A GNU Fortran option used to trigger specific floating-point exceptions during program execution, causing a signal that interrupts the program and generates a debugging file.

    Signup and view all the flashcards

    Floating Point Exception (FPE 'invalid')

    A special type of exception that occurs when a floating-point operation yields a value that is invalid, like the square root of a negative number.

    Signup and view all the flashcards

    Floating Point Exception (FPE 'overflow')

    A floating-point exception that arises when the result of a calculation is too large to be represented in the allocated memory for the given data type.

    Signup and view all the flashcards

    Floating Point Exception (FPE 'underflow')

    A floating-point exception that occurs if the result of a calculation is very close to zero, but not exactly zero, causing a loss of precision.

    Signup and view all the flashcards

    What is GNU Fortran?

    GNU Fortran is a compiler for the Fortran programming language that is part of the GNU Compiler Collection (GCC).

    Signup and view all the flashcards

    Floating Point Exception (FPE 'precision')

    A floating-point exception that occurs if a floating-point operation loses precision, like when the result of a calculation cannot be accurately represented in the allocated memory.

    Signup and view all the flashcards

    Floating Point Exception (FPE 'denormal')

    A floating-point exception that occurs if a floating-point operation generates a 'denormal' value.

    Signup and view all the flashcards

    How is GCC structured?

    GCC is composed of front ends for different languages, a middle end for optimization, and back ends for different systems.

    Signup and view all the flashcards

    What is GENERIC?

    GENERIC is a language-independent code format that results from the front end's translation of source code.

    Signup and view all the flashcards

    Floating Point Exception (FPE 'zero')

    A floating-point exception that occurs if a floating-point operation produces a value that is deemed 'zero'.

    Signup and view all the flashcards

    What is the role of the driver program in GCC?

    The driver program (gcc) manages the compilation process, calling the appropriate front end, assembler, and linker.

    Signup and view all the flashcards

    What file extensions are recognized by GNU Fortran?

    GNU Fortran compiles source code with the '.f', '.for', '.ftn', '.f90', '.f95', '.f03', and '.f08' extensions.

    Signup and view all the flashcards

    What's the difference between fixed form and free form Fortran?

    Fixed form Fortran uses a specific format for source code, while free form uses a more flexible and modern layout.

    Signup and view all the flashcards

    What does the C preprocessor do in the context of Fortran?

    The C preprocessor (CPP) helps with conditional compilation, allowing code sections to be included or excluded based on certain conditions.

    Signup and view all the flashcards

    What preprocessor is used with GNU Fortran?

    The GNU C Preprocessor (in traditional mode) is used for conditional compilation in GNU Fortran.

    Signup and view all the flashcards

    What is the purpose of the '-fmax-stack-var-size' compiler option?

    Specifies the maximum size in bytes for an array allocated on the stack. Exceeding this limit might force the array to be placed in static memory instead.

    Signup and view all the flashcards

    What does the '-fpack-derived' compiler option do?

    Tells the compiler to pack the members of a derived type as tightly as possible in memory, potentially saving space.

    Signup and view all the flashcards

    What is the purpose of the '-frepack-arrays' compiler option?

    Instructs the compiler to copy non-contiguous array sections into a contiguous block of memory at runtime, potentially improving access speed.

    Signup and view all the flashcards

    What is the purpose of the '-fshort-enums' compiler option?

    Makes the compiler choose the smallest integer type that can fit the values in an enumeration set.

    Signup and view all the flashcards

    What is the purpose of the '-fexternal-blas' compiler option?

    Enables the use of BLAS (Basic Linear Algebra Subprograms) functions for matrix operations like MATMUL if the matrix size exceeds a certain threshold.

    Signup and view all the flashcards

    What does the '-frecursive' compiler option do?

    Tells the compiler to optimize procedures without the RECURSIVE attribute, as well as parallel programs, for stack usage.

    Signup and view all the flashcards

    What is the effect of the '-fno-automatic' compiler option?

    Forces the compiler to never allocate local arrays on the stack, instead using static memory.

    Signup and view all the flashcards

    Describe the '-fblas-matmul-limit' compiler option and how it works with '-fexternal-blas'.

    Enables the use of BLAS functions for matrix operations like MATMUL, if the matrix size is larger than a given limit. The limit is set using the '-fblas-matmul-limit' option.

    Signup and view all the flashcards

    LOC

    Returns the address of a variable.

    Signup and view all the flashcards

    C_FUNLOC

    Returns the address of the procedure in C.

    Signup and view all the flashcards

    C_F_PROCPOINTER

    Converts C procedure pointer to Fortran procedure pointer.

    Signup and view all the flashcards

    C_F_POINTER

    Converts C pointer to Fortran pointer.

    Signup and view all the flashcards

    C_LOC

    Returns the C address of an object.

    Signup and view all the flashcards

    C_SIZEOF

    Returns the size in bytes of an expression.

    Signup and view all the flashcards

    BIT_SIZE

    Returns the size in bits of an entity (integer, real, etc.).

    Signup and view all the flashcards

    BTEST

    Returns the value of the bit at a given position in an integer.

    Signup and view all the flashcards

    GETCWD

    Returns the current working directory.

    Signup and view all the flashcards

    GETENV

    Returns the value of an environment variable.

    Signup and view all the flashcards

    GETPID

    Returns the process ID of the currently executing program.

    Signup and view all the flashcards

    GETUID

    Returns the user ID of the currently executing program.

    Signup and view all the flashcards

    PRESENT

    Determines if a given optional dummy argument was specified.

    Signup and view all the flashcards

    SHAPE

    Determines the shape of an array.

    Signup and view all the flashcards

    TINY

    Returns the smallest representable number of a given type.

    Signup and view all the flashcards

    Study Notes

    GNU Fortran Compiler

    • GNU Fortran is a Fortran compiler, part of the GCC compiler suite.
    • It supports Fortran 77, 90, 95, parts of 2003 and 2008 standards.
    • It also supports some vendor extensions.

    GNU Fortran Documentation

    • Published by the Free Software Foundation
    • Licensed under the GNU Free Documentation License.
    • The manual covers invoking GNU Fortran, its command options, runtime, language reference, extensions, mixed-language programming, intrinsic procedures, modules, and contributing sections.

    Table of Contents

    • The table of contents details sections within the manual, including specific topics like introduction, command options, runtime, language reference, extensions, etc.
    • The table is organized by Parts and sections.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Related Documents

    GNU Fortran PDF

    Description

    Test your knowledge about various options available in the GNU Fortran compiler. This quiz covers options like -Wintrinsic-shadow, -Wunused-parameter, and more, helping you understand their implications and uses. Perfect for students and developers looking to deepen their understanding of Fortran compiler behavior.

    Use Quizgecko on...
    Browser
    Browser